How come my if statement isn't working properly?

Python code

IDLE Shell Python

I’m a very beginner coder, so bear with me, but my if statement is printing out even when the required name isn’t typed in. For example, if I typed in Apple, it would still print out Charmander and Charmeleon.

I tried assigning my if statement to input, name, but nothing seems to work, and I’m at a loss for ideas. 

>Solution :

Try using name.lower() so your input will be in lower case and then compare it only with "charmender"

if name.lower()=="charmender":
    print('A')
elif name.lower()=="charmeleon":
    print('B')

Leave a Reply