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 trialnicholas schneider
Courses Plus Student 223 Pointsstuck on challenge task 2 of input and code styling.
I am trying to figure out how to write a line of code for the user input and I am not sure how to work through this. I wrote " print=input(The color, 'favorite_color', is great color") and it is showing me and error message. Why is this incorrect? I have tried multiple variations of this code and I keep getting an error message.
print=("What is your favorite color?")
favorite_color= input("What is your favorite color")
print=favorite_color("is a great color!")
1 Answer
KRIS NIKOLAISEN
54,971 PointsThere are a few ways to do this. Two are:
favorite_color= input("What is your favorite color")
print("The color",favorite_color,"is a great color!")
and
favorite_color= input("What is your favorite color")
print("The color {} is a great color!".format(favorite_color))
nicholas schneider
Courses Plus Student 223 Pointsnicholas schneider
Courses Plus Student 223 PointsAwesome, thank you.