Write a program that prompts the user for a number from 1 to 200 until 113 is encountered. Not including the 113, calculate the average. Do this in python.
DO NOT USE LISTS!
code
total = 0
count = 0
one = int(input("Enter a number(1-200) and 113 to stop: "))
while one != 113:
if one >= 1 and one <= 200:
total += one
count += 1
one = int(input("Enter a number(1-200) and 113 to stop: "))
average = total / count
print("Average is", average)
output
Enter a number(1-200) and 113 to stop: 50
Enter a number(1-200) and 113 to stop: 100
Enter a number(1-200) and 113 to stop: 180
Enter a number(1-200) and 113 to stop: 113
Average is 110.0
Please up vote. Happy Learning!
Get Answers For Free
Most questions answered within 1 hours.