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 trialSkylar Claypool
507 PointsFavorite_Color Input question
Anyone else get this error when you put in "Purple" but it reads it as "Red"?
favorite_color = input("What is your favorite color?")
favorite_color = 'purple'
print("The color",favorite_color,"is a great color!")
2 Answers
Megan Amendola
Treehouse TeacherHi! The challenge is asking you to ask the user for their favorite color and then print it out with the sentence 'The color [input] is a great color!'. The color purple is just an example of what a user's input might be. Your code should be able to take any color input and print it out. Right now you are taking their input and then overwriting it with 'purple' and printing out the message so the message will always be 'The color purple is a great color!'. Instead, the message should always use the input from the user so if they input 'red' as their favorite color, the message will print out 'The color red is a great color!' or 'green' -> 'The color green is a great color!'
Skylar Claypool
507 PointsI was able to fix by removing favorite_color = 'purple'. Thank you!
Skylar Claypool
507 PointsSkylar Claypool
507 PointsFAIL: test_input_called (main.TestUsingInputExecution)
Traceback (most recent call last): File "/usr/local/lib/python3.6/unittest/mock.py", line 1179, in patched return func(*args, **keywargs) File "", line 32, in test_input_called AssertionError: 'Red' != 'purple'
-I did put 'purple' but it is reading it as 'red' and Im not sure why.