Skip to content

Instantly share code, notes, and snippets.

@arsenstorm
Created July 6, 2021 08:30
Show Gist options
  • Save arsenstorm/89e461df35cbf8c2798431e32101b48c to your computer and use it in GitHub Desktop.
Save arsenstorm/89e461df35cbf8c2798431e32101b48c to your computer and use it in GitHub Desktop.
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