Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In regards to the code below written in Python 3.6, I\'m simply trying to use th

ID: 3847327 • Letter: I

Question

In regards to the code below written in Python 3.6, I'm simply trying to use the len function to print out this: You entered (whatever number) values: . I'm not understanding how to use len as a placeholder so to speak so I can put the length within the string. I've got the code to where i can print just the length but I need it within the string above...

___________________________________________________________________

n=int(input("Please enter the amount of numbers to input for finding their average: "))

numbers=[]

for i in range(0,n):
num=int(input("Enter a floating point value: "))
numbers.append(num)
avg=sum(numbers)/n
enteredValues=len(numbers)
enteredValues=print(len(numbers))
print("Total of the entered numbers", sum(numbers))
print("Average of the entered numbers", round(avg,3))
numbers.sort()
print ("The numbers you entered in sorted order: ", numbers)

Explanation / Answer

I have entered that line of code into your previous code.By using format(len(numbers)) you will get what you are asking.The new line of code is marked with a comment (#).

CODE :

n=int(input("Please enter the amount of numbers to input for finding their average: "))

numbers=[]
for i in range(0,n):
num=int(input("Enter a floating point value: "))
numbers.append(num)
avg=sum(numbers)/n
enteredValues=len(numbers)
enteredValues=print(len(numbers))
print ("you entered {0} values".format(len(numbers))) #This is the added line of code.
print("Total of the entered numbers", sum(numbers))
print("Average of the entered numbers", round(avg,3))
numbers.sort()
print ("The numbers you entered in sorted order: ", numbers)

Please rate my answer.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote