Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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
PLUS
Jonathan Fernandes
Courses Plus Student 22,784 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
PLUS
Jonathan Fernandes
Courses Plus Student 22,784 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?