Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python

I need help with a python basics program please/

I keep getting an error on line 5 for some reason. I want to know what I can do to make this program work. I appreciate the help.

name = input("What is your name?") print("Hello", name) question = input("What is your favorite color?"} if question == "blue" print("Blue Bear")

elif question == yellow print("Yellow Banana") else: print("Wrong")

2 Answers

I think I see a few mistakes, but it's difficult to help when you post your code like this.

It looks like you accidentally closed the quote "what is your favorite color?" with a curly brace instead of ending parenthesis, after your 'if' and 'elif' statements you need to put a colon (:), and you didn't put quotations around "yellow"

name = input("What is your name?")
print("Hello", name)
question = input("What is your favorite color?")
if question == "blue":
    print("Blue Bear")
elif question == "yellow" :
    print("Yellow Banana")
else:
    print("Wrong")

side note - Check out the markdown cheatsheet on how to post your code!

Code Wrap your code with 3 backticks (```) on the line before and after. If you specify the language after the first set of backticks, that'll help us with syntax highlighting.

      ```html
      <p>This is code!</p>
      ```
name = input("What is your name?") 
print("Hello", name) 
question = input("What is your favorite color?")
if question == "blue":
    print("Blue Bear")
elif question == "yellow":
    print("Yellow Banana")
else: 
    print("Wrong")