-1

Hello I've been trying to get this line of code working but it keeps going down to the else: statement. Any ideas?

I cant understand what I'm doing wrong for it not to accept the if: condition.

print('What do you get when you cross a snowman with a vampire?')
answer1 = input()
if answer1.lower 'frostbite':
    print ('Huh? how did you know that YOU SPY!')

else:
    print('FROSBITE!')
mgilson
  • 300,191
  • 65
  • 633
  • 696

3 Answers3

2

It's hard to tell with the code fragment since it has a SyntaxError, but I'm guessing you have:

if answer1.lower == 'frostbite':
    ...

The problem here is that answer.lower is a bound method which is clearly not equal to any string. You need to call it to actually generate the lower case string:

if answer1.lower() == 'frostbite':
    ...
mgilson
  • 300,191
  • 65
  • 633
  • 696
0

Someone told me the answer

Thanks friends

print('What do you get when you cross a snowman with a vampire?')
answer1 = input()
if answer1.lower() == 'frostbite':
   print ('Huh? how did you know that YOU SPY!')

else:
    print('FROSBITE!')
0

You have to compare the strings:

print('What do you get when you cross a snowman with a vampire?')

answer1 = input()

correct = 'frostbite'

if answer1.lower == correct :
    print ('Huh? how did you know that YOU SPY!')

else:
    print('FROSBITE!')
Nidal
  • 1,717
  • 1
  • 27
  • 42
Benjamin H
  • 46
  • 2