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 trialKarma Lama
849 Pointslist creation... what am i missing here?
colors = [red, green, yellow, brown , black]
colors = [red, green, yellow, brown , black]
2 Answers
Nicholas Grenwalt
46,626 PointsIn Python words are represented as strings so they must be wrapped in single (') or double (") quotes. So for each of the colors in your list, make sure that they are surrounded with quotes so that they will be correctly read as strings within your list, i.e. 'red' or "red". Either way works.
Manish Giri
16,266 PointsIt's generally a good habit to try and spend some time debugging your code, in case of errors. If there are any error messages shown, that's a good starting point.
If I run your code, I get this error - NameError: name 'red' is not defined
. This should tell you what's wrong, red
should be a string, with quotes -"red"
. Same goes for the remaining colors.
Karma Lama
849 PointsThanks.....again!
Karma Lama
849 PointsKarma Lama
849 PointsThanks for the explanation... I tried doing
colors = ["red, green , yellow, brown, black"]
now I know, I need to put quotes in every single color... thanks again!