Hrythm Python Project
Hrythm Python Project
import time
print()
initialAsk = input("Shall we play a game? Type YES or NO: ")
if str.upper(initialAsk) == "NO":
quitGame()
else:
print("\n"
"Sorry, I don't understand. \n")
initialAsk = input("Shall we play a game? Type YES or NO: ")
else:
play = True
print("\n"
"Let's get started! \n")
###
import random
print("\n"
"%s mode selected. You have 3 tries to guess the correct number. \n" %
(modeSelected))
###
# -- Determines how many hints the user gets based on the selected difficulty
if modeSelected == "EASY":
print("You have up to 3 hints.")
hintsLeft = 3
else:
print("You have up to 21 hints.")
hintsLeft = 21
###
if len(numbersAlreadyGuessed) > 0:
numbersAlreadyGuessed.sort()
print("\n"
"The numbers", numbersAlreadyGuessed, "have been guessed
already. \n")
userGuess = input("Can you guess the number? ")
else:
print("\n"
"You have not currently guessed any number. \n")
userGuess = input("Can you guess the number? ")
###
if hintsLeft > 0:
numberOptions = [num for num in guessRangeList if num !=
randomNumber and num not in numbersAlreadyGuessed]
hintedNumber = (random.choice(numberOptions))
numbersAlreadyGuessed.append(hintedNumber)
print("\n"
"You used a hint. %d is NOT the number you're looking for. \n"
% (hintedNumber))
hintsLeft -= 1
else:
print("You have %d hint left." % (hintsLeft))
print()
userGuess = input("Can you guess the number? ")
else:
print("\n"
"Sorry, you have no more hints. \n")
userGuess = input("Can you guess the number? ")
###
print()
userGuess = input("Can you guess the number? ")
else: # (4B)
print("Sorry, you have run out of tries. The correct
number was %d. \n" % (randomNumber))
askPlayAgain = input("Type 'EXIT' to exit, or 'PLAY' to
play again: ")
else: # (5C)
print("\n"
"Sorry, I don't understand. \n")
askPlayAgain = input("Type 'EXIT' to exit, or
'PLAY' to play again: ")
else: #(5A.2)
print()
gameStart()
else: # (3B)
print("Oops, you've already guessed that number. \n")
userGuess = input("Can you guess the number? ")
else: # (2B)
print("Oops, that's not in the range. \n")
userGuess = input("Can you guess the number? ")
else: # (1B)
print("\n"
"Congratulations! You guessed correctly!")
time.sleep(3)
quit()
# Number Directory:
# (1) - If player guess is wrong or right
# (2) - If player guess is within the range
# (3) - If player guess has been previously been stated
# (4) - Sees how many tries player has left, and what to do if tries = 0
# (5) - Asks the player if he/she wants to play again
###