# # This program finds the average of the entered numbers # (using interactive approach) # # def main(): print("Hello!\nThis program finds the average of entered numbers.\n") sum_=0 # the sum of provided values counter=0 # counter for the number of provided values answer = "yes" # the answer while answer[0]=='y': # while the user says 'yes' or 'yeah' or 'yes' next_value=float(input("Please, input a number:")) # getting the next value sum_=sum_+next_value # adding to the sum counter=counter+1 # incrementing the number of added values answer=input("Do you want to input more numbers (yes or no)? ").lower() # getting users answer and converting it to lower case immediately average=float(sum_)/counter # average print("The average of the entered numbers, rounded off to the nearest hundredth,\ is {0:0.2f}".format(average)) main()