0

I have an if statement in python like so

if number == 1 and letter == a:
    print 'Correct'
else:
    print 'Incorrect'
if number == 2 and letter == b:
    print 'Correct'
else:
    print 'Incorrect'

But it doesn't work.. How do you construct something like this?

1 Answer 1

3

the construction of your if statement is alright. the problem is that

letter == a

and

letter == b

should be

letter == "a"

and

letter == "b"
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.