samedi 30 novembre 2019

if statement returns false, while it is true

I have (>)as input

color = ['grey', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white']
nickcolor = input()
>red
nickcolor in color
>True

Then I write

if nickcolor in color == True:
    print('You are now logged in ' + nickname + ' !\n Write something in chat!')
else:
    print('Error occured. Please restart.')
>Error occured. Please restart.

Why does in if statement it is a false?

Aucun commentaire:

Enregistrer un commentaire