Python_Worksheet_5_While_loops (1)
Python_Worksheet_5_While_loops (1)
Introduction to Python
Adding Program
count 0
runningTotal 0
input number
while number <> 0
count count + 1
runningTotal runningTotal + number
input next number
display count
display runningTotal
Compare the pseudocode above to the Python code below for the planned program. Use
this to help you write your own program using the while loop.
#Adder
print("Keeping a running total")
print("***********************\n")
print("Enter numbers to add together then press 0 to exit.")