Created
January 17, 2020 23:21
-
-
Save yosefsadek/f1d9a60dc463126f6593e77a9bcf16de 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
answer = 15 | |
attempts= 0 | |
userentry="" | |
#a loop that repeats while the users guess is not the same as the answer | |
while answer != userentry: | |
userentry = int(input("Enter a number between 1 and 20 ")) | |
#each time through the loop 1 is added to the number of attempts | |
attempts=attempts+1 | |
#after the loop it will say how many attempts it took | |
print("Well done you correctly guessed the number it took you " + str(attempts) + " attempts") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment