-1

I'm sorry as this is probably a dumb question, but I'm just beginning to learn to code Python and I'm trying to make a game that checks certain inputs from the users. The script, however, is not accepting the correct answer and running the next function.

def left2():
    x = 5 + 5  


def left():
    x = raw_input("What is Dwyane's last name?")  
    x = x.lower # changes to the lowercase version of the name 

    if x == 'johnson':  # Code stopping here, It's not recognizing the input
        left2()
    elif x == "":
        left2()
    else:
        print "You're lost!" # This is displayed regardless of what I type
Daniel Roseman
  • 588,541
  • 66
  • 880
  • 895
Codezilla
  • 95
  • 1
  • 7

2 Answers2

2

I think the issue is with the second line of left() which should read:

x = x.lower() # changes to the lowercase version of the name 

The parentheses call the lower method on x and reassign what that returns to x, rather than just setting x to the callable method itself.

0

You're assigning x to a function object, not to the string returned as result.

code should be:

x = x.lower()
Josep J.
  • 54
  • 1