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 Meet Python Using Input

Jack Cummins
Jack Cummins
17,417 Points

Need help with code challenge. Why am I wrong?

Use the favorite_color variable with your print statement to output the following message to the screen :

The color [USER INPUTTED COLOR] is a great color!

What code would pass this scienario? Jack

Thanks!

using_input.py
favorite_color = input("What is your favorite color? ")
print("The color ", favorite_color, " is a great color")

2 Answers

Brandon Spangler
Brandon Spangler
8,756 Points

print("The color "+favorite_color+ " is a great color") Also, Rimvydas Česonis code does pass.

Rimvydas Česonis
Rimvydas Česonis
8,170 Points

Hello,

print("The color ", favorite_color, " is a great color") # you left extra space on both of your strings one after and one in front of it. You need only one, first one.

Updated: for Task 1

favorite_color = input("What is your favorite color? ")

for Task 2

favorite_color = input("What is your favorite color? ")
print("The color ", favorite_color, "is a great color")

I did not post you correct answer at first, because I wanted you to find it yourself, but here it is. I checked it myself and it works.

Jack Cummins
Jack Cummins
17,417 Points

That code does not pass. :angry:

Craig Dennis
Craig Dennis
Treehouse Teacher

The extra space in "The color " is not needed. print with multiple arguments will join all values separated by spaces.

Jack Cummins
Jack Cummins
17,417 Points

Thanks Craig! You are the best! You are my favorite teacher on treehouse. I love your teaching style!