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 trialstevengibbs
4,148 Pointschallenge task
Hi everyone, can someone explain me what I'm doing wrong here?
favorite_color = "Red"
input("The color"), (favorite_color), ("is a great color!")
1 Answer
Mel Rumsey
Treehouse ModeratorHey stevengibbs !
The first thing we want to do is create a variable that equals the input of user types in. Let's just use names for this example:
users_name = input("What is your name? ")
So, in the console, this will as the user, What is your name? If you respond with "Steven", the users_name variable will now hold that input as a string
users_name = "Steven"
Then we want to print a string containing that variable (Which I will use concatenation, just in case you haven't learned about fstrings or string formatting yet):
print("Hi there, " + users_name + "! It's nice to meet you.")
Which will then print the string with the user's input. Here is the output:
Hi there, Steven! It's nice to meet you!
Hopefully this helps you see and understand how it is formatted. You can save any input to a variable this way. It makes your program super flexible. :D Happy coding!!