Skip to content

Instantly share code, notes, and snippets.

@prakhar1989
Created August 30, 2014 19:01
Show Gist options
  • Save prakhar1989/03cb8846201f86128e64 to your computer and use it in GitHub Desktop.
Save prakhar1989/03cb8846201f86128e64 to your computer and use it in GitHub Desktop.
Game
import random
if __name__ == "__main__":
# this decides whether the user wants to continue
choice = True
# the main game loop
while choice:
print "Random number: " + str(random.random() * 100)
print "Do you want to continue? Y/N?: ",
user_choice = raw_input()
if user_choice == 'n' or user_choice == "N":
print "Thanks for playing!!!"
choice = False
@prakhar1989
Copy link
Author

chosen_word = 'R O H A N'
user_word   = '_ _ _ _ _'

When the user guesses N

chosen_word = 'R O H A N'
user_word   = "_ _ _ _ N"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment