# # This program finds the average of the inputed numbers # (using sentinel approach) # # def main(): print("Hello!\n\ This program finds the average of entered values using sentinel approach.") sum_=0 # the sum of provided values counter=0 # counter for the number of provided values next_value=0 # values entered by the user are referenced to by next_value while next_value != -1000: # termination condition: value -1000 sum_=sum_+next_value # adding the provided value to the sum counter=counter+1 # incrementing the number of added values next_value=float(input("Please, input a number (input -1000 if you want to stop):")) average=float(sum_)/(counter-1) # average print("The average of the entered numbers, rounded off to the nearest hundrendth,\ is {0:0.2f}".format(average)) main()