In: Computer Science
Write a program IN PYTHON of the JUPYTER
NOOTBOOK that keeps getting a set of numbers from user
until the user enters "done". Then shows the
count, total, and
average of the entered numbers.
This should the answer when finished
Enter a number: 55
Enter a number: 90
Enter a number: 12
Enter a number: done
You entered 3 numbers, total is 157, average is 52.33333
Python code:
#accepting first number
num=input("Enter a number: ")
#initializing count as 0
count=0
#initializing total as 0
total=0
#looping till done is entered
while(num!="done"):
#incrementing count
count+=1
#adding num to total
total+=int(num)
#accepting next number
num=input("Enter a number: ")
#printing count,total and average
print("You entered {} numbers, total is {}, average is
{:.5f}".format(count,total,total/count))
Screenshot:
Input and Output: