So, here it is:
import random
dictionary=['ABRUPT','BLITZ','BUCCANEER','CROISSANT','BEFUDDLE','GIZMO','HAIKU','JOVIAL','NUMB','SQUAWK','THE','MAGIC','ARTIST','TRAVEL','NOWADAYS','ITALIAN','MOUSTACHE','GLOOMY','STARTLED','AMBIGUOUS','GREEN','NUMBER','HANDYMAN','RATCHET','BOILED','ENCRUSTED','AROUND','CHIMPANZEE','PARAKEET','BOOTSTRAPS']
difficulty=str(input("would you like an easy, medium, or hard word?"))
for word in dictionary:
if difficulty == "easy":
word=random.choice(dictionary[21:31])
elif difficulty=="medium":
word=random.choice(dictionary[11:21])
elif difficulty=="hard":
word=random.choice(dictionary[0:11])
wordLength=len(word)
wrongGuesses=''
rightGuesses=''
numGuesses=0
guesses=wordLength*[' _ ']
alreadyGuessed=''
maxWrong=6
gamePoints=0
gameOver=numGuesses>=maxWrong
def whatLevel(difficulty):
if difficulty == "easy":
print(word)
elif difficulty == "medium":
print(word)
elif difficulty == "hard":
print(word)
else:
print("Error: Please try again and type in 'easy', 'medium', or 'hard' for your difficulty level:")
def printRules(maxWrong, wordLength):
wordLength=1
print("Guess the word in 7 tries!")
return
def getGuess():
print
guess=input("Guess a CAPITAL letter: ")
guess.strip()
guess.upper()
print()
return guess
printRules(maxWrong, wordLength)
def nextGame():
playAgainResponse=input('Play Again?')
if input==("Yes"):
difficulty
wrongGuesses=''
rightGuesses=''
gamePoints=gamePoints+rightGuesses
while not gameOver:
letter=getGuess()
if len(letter)==1 and letter in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ':
if alreadyGuessed.find(letter)!= -1:
print ("You already picked", letter)
else:
alreadyGuessed=alreadyGuessed+letter
firsttryWord=word.find(letter)
if firsttryWord==-1:
wrongGuesses=wrongGuesses+letter
print("Oops! ",letter,"is not in the word.")
else:
print("Yes! ",letter,"is in the word!")
rightGuesses=rightGuesses+letter
for instances in range(wordLength):
if letter == word[instances]:
guesses[instances]=letter
else:
print("Please guess a single alphabetical letter!")
print(''.join(guesses))
print ("Missed Letters: ", wrongGuesses)
if len(wrongGuesses)==maxWrong:
print ("You lose!")
print("The word was "+word)
if gamePoints == int:
print("You have "+gamePoints+" points!")
else:
print("You have 0 points.")
gameOver
nextGame()
for i in range(wordLength):
if word[i] not in rightGuesses:
allLettersFound=False
break
if allLettersFound:
gamePoints=gamePoints+10
print("You win!")
print("The word was", word)
print("You have",gamePoints,"points!")
gameOver
nextGame()
break
getGuess()
nextGame()

New Topic/Question
Reply



MultiQuote



|