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 trialTyler Sewell
139 PointsThe print function keeps turning yellow as if it's trying to become a script. I am beyond confused. Any suggestions?
Trying to do this:
1 favorite_color = ("green") 2 print ("The color") favorite_color ("is my favorite!")
favorite_color = ("green")
print("The color") favorite_color ("is my favorite!")
2 Answers
Steven Parker
231,198 PointsYou don't need parentheses around the value you assign to the variable, and you need only one set around all the arguments to "print". The arguments inside should be separated with commas.
favorite_color = "green"
print("The color", favorite_color, "is my favorite!")
Christopher Gardner
12,719 PointsOn top of what Steven Parker said, you can also use conjugation, like so:
favorite_color = "green"
print("The color " + favorite_color + " is my favorite!")
Notice that you have to include spaces in the strings (like after the word color, and before is in the last string) if you want them to show when you print.
Steven Parker
231,198 PointsI think the word you were looking for is concatenation.
Christopher Gardner
12,719 PointsSteven Parker Thanks for the catch! Can't believe I did that, haha.
Kya French
194 Pointsi was stuck on that question too thx