Created
January 17, 2020 23:23
-
-
Save yosefsadek/79b9f3dc4d0c53b191388e74ac244694 to your computer and use it in GitHub Desktop.
py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
total = 0 | |
another = "Y" | |
#the loop will repeat while the user types Y when asked if they want to enter another number | |
while another == "Y": | |
#asks the user to enter a number | |
number = int(input("Enter a number to add to the total: ")) | |
#adds the number entered to the total | |
total = total + number | |
#asks the user if they want to enter another number | |
another = input("Do you want to enter another number? Y/N ") | |
#after the loop ends it outputs the total | |
print("The total of your numbers was" + str(total)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment