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 trialjrmcintyre
4,892 Pointsgreen is not defined
don't quite get the problem but the error message says green is not defined
colors = [green, red, blue, black, white]
1 Answer
Todd Anderson
4,260 PointsHi!
None of those are defined because the list is expecting strings but you have forgotten the "" around each color.
Hasan Ahmad
6,727 PointsHasan Ahmad
6,727 PointsIn your code, the list of colours are being interpreted as variables by python, hence you get an error saying that green is not defined. However, if you add quotes around each colour in the list, the colours will be strings. For example:
animals = ["Panda", "Bear", "Rabbit", "Pigeon"]
Always remember these data types and how they are created: ** Strings **:
** Integer **
** Float **
I hope this helps!