Python Python Basics Types and Branching Use an if

How do I check that favourite_color = "blue" ?

I've used an if statement and I'm not able to check

branching.py
favorite_color = input("What is your favorite color?  ")
if favourite_color == "blue":
    print("You must love the sky")    

2 Answers

Jonathan Fernandes
PRO
Jonathan Fernandes
Pro Student 22,745 Points

I just ran the following code in my interpreter and it works fine:

color = "blue"

if color == "blue":
  print("You must love the sky")

Do you mind giving me more details on the output you are getting and the environment? Because your code should be fine.

Thanks for helping. I noticed my error. In the UK we spell favorite different so technically I was using the wrong variable name.

Jonathan Fernandes
PRO
Jonathan Fernandes
Pro Student 22,745 Points

Oh wait... is their too much spacing on your indent? Or inconsistent spacing? In other words, is this a piece of your code and that print line is the only thing that is over-indented?