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 trialBrad Nobel
3,394 PointsPython Basics: Challenge task 2 of 2 I am receiving to different errors that seem to contradict each other.
Use the favorite_color variable with your print statement to output the following message to the screen : The color [USER INPUTTED COLOR] is a great color! I will respond with my favorite color when I run your script. For instance, if I enter "purple" I want your code to print: The color purple is a great color!
Here is what i entered first. favorite_color = input("What is your favorite color?") favorite_color = "Red" print("The color", favorite_color, "is a great color!")
then here is my output. Output for using_input.py The color Red is a great color!
Here is the error i get. Bummer: AssertionError: 'Mauve' not found in 'The color Red is a great color' : Make sure you are printing out 'The color Mauve is a great color!' (Mauve is my favorite that I inputted)
Then I changed "Red" to "Mauve"
Here is what i entered favorite_color = input("What is your favorite color?") favorite_color = "Mauve" print("The color", favorite_color, "is a great color!")
Output for using_input.py The color Mauve is a great color!
Bummer: : Hmm...I answered the prompt with 'Red' but that's not what was in the variable favorite_color
I'm not sure am understanding what the issue is?
favorite_color = input("What is your favorite color?")
favorite_color = "Mauve"
print("The color", favorite_color, "is a great color!")
2 Answers
caits
4,578 PointsYou're defining favorite_color after you ask for the user to define it. You want to use the user input for favorite_color. Basically, delete the second line and you're good to go!
Luke Moloney
111 PointsThanks caits!!