Skip to content Skip to sidebar Skip to footer

Python: Adding Values In A While Loop

Using a while loop, I'm prompting the user to enter 5 different numbers and trying to create a total of those numbers. How would I be able to create that total? This is my code so

Solution 1:

count = 1
total = 0

while count < 5:
    count += 1
    total += int(input("Enter a value: "))

print (total)

Post a Comment for "Python: Adding Values In A While Loop"