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 trial
Josh Foster
696 Pointspython list code challenge
i am having great diifculty with this code challenge https://teamtreehouse.com/library/python-basics/python-data-types/list-creation
i have tried various ways but i am just lost
any help much appreciated
2 Answers
Daniel Gauthier
15,000 PointsHey Josh,
The challenge just wants you to show that you understand how to create a list.
The code below works:
colors = ["blue", "red", "green", "black", "white"]
Remember to put quotation marks around the names of the items in the list since they're string values.
Good luck!
Sergio Niño
Full Stack JavaScript Techdegree Student 22,976 PointsJosh Foster, Hi list(python or array(ruby, javascript) is the same thing, is the same structure to create them,the only thing is that in javascript you add the keyword 'var' at the begining when you declare the array and a semicolon at the end. then the same thing: name of the array or list you want to create, then the equal sign, next the square brackets and inside of it the values you want to hold. in this case the challange ask you to create a list of colors('strings'), of at least 5 items, so you have to choose the colors you want and put them inside.
colors = ['red', 'green', 'blue', 'yellow', 'brown']
I hope this helps clear it up. :)