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

Dinmukhamed Dostemessov
Dinmukhamed Dostemessov
1,461 Points

What is the problem here? I don't get it.

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

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

1 Answer

derekverrilli
derekverrilli
8,841 Points

There are a couple things.

First, instead of printing the message you are assigning everything in the parentheses to the variable named "print". Remove the '=' and leave no space after 'print' to fix that.

Second, to concatenate the strings you need '+'. Replace the commas with '+' and leave spaces in the strings for the variable to fit.

favorite_color = input("What is your favorite color? ")
print("The color " + favorite_color + " is a great color!")
Dinmukhamed Dostemessov
Dinmukhamed Dostemessov
1,461 Points

Thanks buddy! I don't understand why on earth I've put '=' after 'print', and I had no idea about those spaces.

derekverrilli
derekverrilli
8,841 Points

No problem! Mistakes are the way to learn. Keep it up!