Created
March 11, 2021 16:36
-
-
Save gitaficionado/7c023d20bc17350c3cbdc02c7fc8f9e2 to your computer and use it in GitHub Desktop.
Prompt the user for a number from 1 to 100. Using a while loop, if they entered an invalid number, tell them the number entered is invalid and then prompt them again for a number from 1 to 100. If they enter a valid number - thank them for their input.
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
''' | |
1. Prompt the user for a number from 1 to 100. Using a while loop, if they entered an invalid number, tell them the number entered is invalid and then prompt them again for a number from 1 to 100. If they enter a valid number - thank them for their input. | |
Prompt the user for a number from 1 to 100 | |
While that number is less than 1 or that number is more than 100 | |
Output that they entered an invalid number | |
Prompt them again for a number from 1 to 100 | |
Output to the user, thanking them for their input | |
''' | |
# Loop Problem 1 | |
_______ = int(input("Please enter a number from 1 - 100: ")) | |
while _______ < 1 or ________ > 100: | |
print("You entered an invalid number.") | |
_________ = int(input("Please enter a number from 1 - 100: ")) | |
print("Thank you for your input.") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment