I've been trying to code a game using python where I need the player's answer to be accepted as the same as the correct answer however regardless of whether or not the answer is correct it still proceeds as if the answer is incorrect
This is the code:
def EasySongs1(easy):
f=open('easy.txt')
lines=f.readlines()
songline=random.randrange(1,30)
answereasy=(lines[songline])
f=open('easyq.txt')
lines=f.readlines()
questioneasy=(lines[songline])
print(questioneasy)
life1=str(input("Guess the song "))
if life1 is answereasy:
return("good job")
if life1 is not answereasy:
life2=str(input("2 lives left,Guess again "))
if life2 is not answereasy:
life3 = str(input("last chance, guess again "))
if life3 is not answereasy:
sys.exit("you messed up")
I've already tried both is and == Anyone got any idea on how to fix this?