Guess My Number
import random
print(""" _____ __ ___ _ __ __
/ ___/_ _____ ___ ___ / |/ /_ __ / |/ /_ ____ _ / / ___ ____
/ (_ / // / -_|_-<(_-< / /|_/ / // / / / // / ' \/ _ \/ -_) __/
\___/\_,_/\__/___/___/ /_/ /_/\_, / /_/|_/\_,_/_/_/_/_.__/\__/_/
/___/
""")
#generate our random number
myRandomNumber = random.randint(1,100)
# '==' - is this equal to?
# '!=' - is this NOT equal to?
# '>' - is this GREATER than?
# '<' - is this LESS than?
# '>=' - is this greater than or equal to?
# '<=' - is this less than or equal to?
#elif
#loops
#for loop
#while loop
#boolean to know if the user is correct
isGuessCorrect = False
timesToGuess = 7
timesUserHasGuessed = 0
while isGuessCorrect == False and timesUserHasGuessed < timesToGuess:
timesUserHasGuessed += 1
#get the user's guess
userGuess = input("Please type a number:")
#converts the userGuess into an Integer
userGuessInt = int(userGuess)
#first check if they have guessed correctly
if userGuessInt == myRandomNumber:
print("You have guessed correctly!")
isGuessCorrect = True
elif userGuessInt != myRandomNumber:
print("You have guessed wrong!!!!")
isGuessCorrect = False
#if they are wrong, lets tell them why
if isGuessCorrect == False:
if userGuessInt > myRandomNumber:
print("too HIGH")
elif userGuessInt < myRandomNumber:
print("too LOW")
print("you have guessed", timesUserHasGuessed, "time(s)")
if timesUserHasGuessed == timesToGuess and isGuessCorrect == False:
print("WOW, you lose!")