I'm trying to create a program that finds the average of n numbers inputted but I'm having trouble getting the recursions to work. The program sort of works but it doesn't exit out of the while statement when I want it to.
print("This program 'is' designed to find the average of n numbers you input\n") #print statement that introduces the average finder
counter = 0 #this counter will count how many numbers the user has inserted into the program and will be used as denominator
sum_of_numbers = 0 #this number is set as 0 as currently the sum is 0, as more numbers are inputed, they will be added together
first_question = input('''Would you like to enter a number? Type "yes" if you do, and "no" if you don't. \n\n''') #takes input of yes or no to see whether user wants to find average of numbers
while first_question == "yes" :
ent_num = int(input("Enter your number here:"))
sum_of_numbers = sum_of_numbers + ent_num
counter = counter + 1
second_question = input('''Would you like to enter another number after this? Type "yes" if you do, and "no" if you don't. \n''')
while second_question == "yes" :
ent_num = int(input("Enter your next number here: "))
sum_of_numbers = sum_of_numbers + ent_num
counter = counter + 1
else :
print("Your average is " + str(sum_of_numbers/counter))
Can someone please help me figure it out?
I can't use functions such as try or eval or len its all really basic stuff like the 3rd day in my class