# This program computes the average of values that are entered by the user.
# It also tells you what the sum of the numbers entered is.
# Program also tells you how many numbers were entered by the user.
sum_of_nums = 0 #starting point for the sum
count_of_nums = 0 #starting point for the count
# The user can enter as many numbers as desired.
while True:
value_entered = input("Enter a number or press q to quit: ")
# vvv This allows the program to stop asking the user for further inputs.
if value_entered == "q":
# vvv If the user does not input any numbers and immediately quits the
# vvv program, there will be an error message. This if condition checks
# vvv if there were no inputs and solves the error by quiting the program.
# vvv Use count_of_nums because if user puts in 0, the sum_of_nums would be 0,
# vvv but the user did put a number in. count_of_nums == 0 ensures there were
# vvv actually no inputs.
if (count_of_nums == 0):
break
else:
average_of_nums = sum_of_nums/count_of_nums
print(f"The sum of the numbers entered is {sum_of_nums}.")
print(f"The count of the numbers entered is {count_of_nums}.")
print(f"The average of the numbers entered is {average_of_nums}.")
break
else:
value_entered = int(value_entered) #changes the string into an integer
sum_of_nums += value_entered
count_of_nums += 1