x=input("Do you want to enter number Y/N:")
numbersEntered= 0
while x == "Y":
number = int(input("Enter number :"))
numbersEntered=numbersEntered+1
y=input("Do you want to continue entering new numbers: Y/N:")
if y == "N":
break
average=/numbersEntered
print(average)
Using Python.This is what I have so far. I need to add all the user inputs together once the user enters “N”. I just do not know how to do this. Any help is appreciated.
You don’t ‘need to add all the user inputs together once the user enters “N”‘, per se.
Create a new variable,
total(don’t call itsum, that’s a Python built-in), initialise it to0and addnumberto it with each iteration. You’d do this in much the same way as you’re currently calculatingnumbersEntered.Then you need to correct your
averagecalculation to taketotalinto account.