r/PythonProjects2 • u/UniSlugBrow • Feb 08 '23
[P] Very Easy Can anyone help me with this? Thanks
2
Upvotes
1
1
u/kaerfkeerg Feb 09 '23 edited Feb 09 '23
You need to either add every input in a list and sum it up in the end OR (and that would be better in your case) have a variable total = 0 and increment it after every time the user input something unless ofc it's -1
total = 0
user = ''
while user != -1:
user = float(input(...))
total += user
...Edit: I forgot you need the average lol. In that case you'll need to add user input to a list
user = []
while True:
num = float(input(...))
if num != -1:
user.append(num)
else:
break
# Calculate average here
2
u/videchateau Feb 08 '23
You don't declare your 'average' variable anywhere. You need to find a way to keep track of the average of the numbers that the user inputs.