. Write a program to prompt the user for first to enter the Numbers, and then use the while loop repeatedly prompt the user for the Numbers, and add the Numbers to the running total, when the input the correct number, the program should print the average, this program should be how to write
CodePudding user response:
The code below
Def num_average () : _sum=0 # calculation combined Count=0 # statistical total input While True: Numerical (value=https://bbs.csdn.net/topics/input (" please enter exit input "q" to end the operation and print the average) : ") If the value. The lower ()! '=' q: N=float # (value) converts a string to a floating-point _sum +=n Count +=1 Elif value. The lower ()=='q' : Print (f "is the sum of input for {_sum}, average for {_sum/count}") Break