python-by-example-150-chall.../challenges35-44/challenge-042.py

12 lines
301 B
Python
Raw Permalink Normal View History

2019-07-17 14:56:46 +08:00
total = 0
sub_total = 0
for i in range(0, 5):
number = int(input('Enter a number : '))
sub_total = sub_total + number
choose = str(input('Would you like to add numbers to total? yes|no : '))
if choose.lower() == 'yes':
total = total + sub_total
print(total)
else:
print(total)