Created
October 19, 2015 07:27
-
-
Save accessnash/8d1f105d8c5871748897 to your computer and use it in GitHub Desktop.
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
secret = 17 | |
guess = 0 | |
guess_count = 1 | |
while guess != secret: | |
guess = int(input("Guess a number: ")) | |
if guess_count >= 5: | |
print("You've exceeded the maximum number of tries. The secret number was:", secret) | |
break | |
elif guess > secret: | |
print ("Guess lower. No of tries left:", 5- guess_count) | |
elif guess < secret: | |
print ("Guess higher. No of tries left:", 5- guess_count) | |
else: | |
print ("Correct!The secret number was:", secret) | |
break | |
guess_count += 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment