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 trialMichael Martin
277 PointsCan someone help me with the problem in Challenge 2 of Python Basics? It's the one with using_variable.py.
This is what I have for my code. I keep getting a EOFError message. Any suggestion would be appreciated. Thanks.
favorite_color = ("blue") favorite_color = input("What is your favorite color? ") print('The color', favorite_color, 'is my favorite!')
favorite_color = ("blue")
favorite_color = input("What is your favorite color? ")
print('The color', favorite_color, 'is my favorite!')
2 Answers
Viraj Deshaval
4,874 PointsYou are seeing the error because your 'input()' function reaches End of file and caused the issue. Remove the line where you are asking the input, its not required as we use favorite_color variable reference you already declared above with value 'blue'. Also make a note that when you add values to variables for example only string in this case do not use '()'. Let me know if you still face any issues. #HappyCoding
Michael Martin
277 PointsThanks to Gabriel and Viraj for the input and suggestions. Thanks to you I was able to correct my code!
Gabriel Rumbaut
2,476 PointsGabriel Rumbaut
2,476 PointsLook at your syntax. You're passing a string into the favorite_color variable. However, strings don't take parentheses.