Created
June 30, 2018 08:49
-
-
Save kks32/3c4f9c49490d83e9f55b4089ee88f48c 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
import random | |
#welcoming the user | |
name = raw_input("What is your name? ") | |
print "Hello, " + name, "Time to play hangman!" | |
print "Start guessing..." | |
#generates random word | |
# Create a list of words the player has to guess | |
words = | |
# Select a random word from the list of words and store it in word | |
# Hint: Use random.choice to get a random word from the list | |
# word = | |
#creates a variable called guesses with an empty value | |
guesses = '' | |
#determine the number of turns | |
turns = 10 | |
# Create a while loop | |
#check if the turns are more than zero | |
# make a counter called failed that starts with zero | |
# for every character in secret_word | |
# see if the character is in the players guess | |
# print then out the character | |
# if not found, print a dash | |
# and increase the failed counter with one | |
# if failed is equal to zero | |
# print You Won | |
# exit the script | |
# hint use break | |
# ask the user to guess a character and store it in guess | |
# Hint: Check how we got the user name | |
# guess = | |
# set the players guess to guesses | |
# if the guess is not found in the secret word | |
# turns counter decreases with 1 (now 9) | |
# print wrong | |
# how many turns are left | |
# if the turns are equal to zero | |
# print "You Lost, sad face" | |
# print"the word was:" | |
# print(word) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment