Created
July 6, 2021 08:30
-
-
Save arsenstorm/89e461df35cbf8c2798431e32101b48c 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
name = str(input("Enter your name\n>>> ")) | |
chance = 0 | |
cname = "Rumplestiltskin" | |
hasGuessedName = False | |
while hasGuessedName == False: | |
guess = str(input("Guess my name\n>>> ")) | |
chance = chance + 1 | |
attempt = 5 - chance | |
if chance >= 5: | |
if guess == cname: | |
print("Hey, you guessed my name!") | |
hasGuessedName = True | |
else: | |
print("Wrong, try again!") | |
else: | |
if guess == cname: | |
print("Hey, you guessed my name!") | |
hasGuessedName = True | |
else: | |
print("Wrong, try again!\nRemaining attempts: ", attempt) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment