i know there's something im doing wrong but what is it exactly I've got it put back in the bottom but know what i do when i got to run it does #nothing just sits at a blank screen. i've even tried just taking it out of the function and making it run that way but still noting help would be much appreciated.
enter code here#Hang Man Game
#This is a program to play the game Hang Man it will contain a list
of
words and you must figure those words out
import random
import string
def Main():
Game=['Play a game of Hang Man with me, Let the game begin']
#main game
Go_again = True
while Go_again:
hints = {"python" : "A program",
"keyboard" : "You type on this ",
"slow" : "Sloths move what?",
"small" : "Ants are ",
"fast" : "The Flash is.",
"car" : "you drive a what?",
"wall" : "a house has 4 ",
"phone" : "used to make calls",
"bottle" : "cotains a lquid",
"turtle" : "can beat a rabbit in a race"}
word = ("python", "keyboard", "slow", "small", "fast", "car", "wall",
"phone", "bottle", "turtle")
hint = 'hint'
chosen_word = random.choice(word).lower()
guess = None
guessed_letters = []
word_guessed = []
for letter in chosen_word:
word_guessed.append("-")
joined_word = None
if guess == hints:
if word == 'python':
print (hints["python"])
elif word == 'keyboard':
print (hints["keyboard"])
elif word == 'slow':
print (hints["slow"])
elif word == 'small':
print (hints["small"])
elif word == 'fast':
print (hints["fast"])
elif word == 'car':
print (hints["car"])
elif word == 'wall':
print (hints["wall"])
elif word == 'phone':
print (hints["phone"])
elif word == 'bottle':
print (hints["bottle"])
elif word == 'turtle':
print (hints["turtle"])
while (attempts != 0 and "-" in word_guessed):
print(("\nYou have {} attempts remaining").format(attempts))
joined_word = "".join(word_guessed)
print(joined_word)
try:
player_guess = str(input("\nPlease select a letter between A-Z" + "\n> ")).lower()
except:
print("That is not valid input. Please try again.")
else:
if not player_guess.isalpha():
print("That is not a letter. Please try again.")
elif len(player_guess) > 1:
print("That is more than one letter. Please try again.")
elif player_guess in guessed_letters:
print("You have already guessed that letter. Please try again.")
else: pass
while (guess != correct) and (guess != "") and (guess != 'hint'):
print ("Sorry, that's not it.")
guess = input("Your guess:\n>>>")
guess = guess.lower()
if guess == correct:
print ("That's it! You guessed it!\n")
print ("5")
def random_word(words):
word = random.choice(words)
word = word
correct = word
return word
print ('game')
Main()
Comments
Post a Comment