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.
I don't know this task I tried it and watched the video but its really hard to understand, Thanks for reading
favorite_color = input('What Is Your Favorite Color?') print("favorite_color") print("My favorite color is blue")
Here is one way to solve it for basic level.
#favorite_color = input('What Is Your Favorite Color?') favorite_color = input('What is your favorite color? ') #--> remember space at the end <-- #print("favorite_color") print('The color ' + favorite_color + ' is a great color!') # --> remember space after '...color ' and before ' is a..' <--
Hi arix business ,
Your code so far looks good, but needs a few adjustments.
So in general this task is about asking the user what their favorite color is and then printing on the screen the color they entered together with the text "The color [color] is a great color!".
First, make sure you are doing exactly what the task is asking. The first task tells you exactly what you should ask in your input "What is your favorite color? ". You must copy/write it exactly as the question says, with the same letter case and spacing (notice the extra space at the end of the question), otherwise it wont pass the check.
On the second step of this task you need to print the user input, which you saved in the first step to the variable favorite_color. Right now what you are printing is just a string with the word favorite_color in it, so you are not displaying the actual variable value. To print the actual variable value you need to place the variable name without quotes inside your print statement, but the print statement should also include the rest of the text that needs to be printed. You should only have one print statement that combines the text that needs to be printed with the value stored in the favorite_color variable.
Make sure to go over your notes or the course video to review how to include the variable value in the print statement together with the rest of the string.
Hope this helps
Asher OrrPython Development Techdegree Graduate 9,086 Points
Hi Arix Business!
The challenge asks you to ask for a user's input, then store it in a variable. You did that perfectly with this line of code:
favorite_color = input('What Is Your favorite color?')
When someone runs a Python script with that line of code, they will see "What is your favorite color?" printed to the screen. They'll type their answer and press enter. Python will remember their answer. Specifically, it will store it in the variable favorite_color.
Check out the next line of code:
favorite_color = input('What is your favorite color?') print(favorite_color)
Now, Python will print whatever is stored in the variable favorite_color.
The second step in the challenge is asking you to write a print statement that prints out "The color [their color] is a great color!" to the screen.
Currently, your code is doing this:
favorite_color = input('What is your favorite color?') # ask user for their favorite_color print(favorite_color) # print whatever they enter print("My favorite color is blue") # print "my favorite color is blue"
It should look like this:
favorite_color = input('What is your favorite color?') # ask user for their favorite_color print("The color [their_color] is a great color!")
You may be thinking "but how do I get my user's response, which was stored in favorite_color, in the print statement?" To answer that, check this out: https://realpython.com/python-string-formatting/#2-new-style-string-formatting-strformat
I hope this helps!