samedi 12 août 2017

How do i a compare two variables in an if statement in python? [duplicate]

This question already has an answer here:

Bcolour = ("blue")
print ("Hey Stranger! I'm BlueBot. As you might have gussed, My favourite       colour is blue.")
Colour = input("what's yours? ")
if colour.lower() == Bcolour.lower():
     print ("Oh cool, great minds think alike am I right?")
else: print ("meh, I don't really like" + colour + "but its your choice")

This is my code so far, and I am trying to make the response match the colour input, and it runs, but once i enter something I get this feedback:

Traceback (most recent call last):
  File "C:/Users/Familie/Freise/Torben/2017/GCSE COMPUTING/Work      (done)/Python2K17/Intro.py", line 3, in <module>
    Colour = input("what's yours? ")
 File "<string>", line 1, in <module>
NameError: name 'blue' is not defined

help?

Aucun commentaire:

Enregistrer un commentaire