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 trial3 Answers
Ed H-P
2,728 PointsSorry for taking so long to get back to you.
So if you're still stuck on this: Python lists are square brackets containing a series of data types separated by commas.
# They can be empty:
my_list1 = []
# Or can contain any data type, such as strings, integers, floats:
my_list2 = ["hello", 1, 9.5]
# And you can even have lists inside lists:
my_list3 = ["world", ["This is a list inside a list"], 3]
Does that help you get started?
And a quick side note - don't forget list indices start at zero, i.e. [0] is the first item, [1] is the second, etc. For example:
my_list3 = ["world", ["This is a list inside a list"], 3]
print(my_list3[0])
>>> "world"
print(my_list3[1])
>>> ["This is a list inside a list"]
print(my_list3[2])
>>> 3
Isach Stevik
1,154 Pointsho, I'm sorry! Create a single new list variable named my_list. Put 3 numbers and 2 strings into it in whatever order you want. For the last member, though, add another list with 2 items in it.
Ed H-P
2,728 PointsThanks! Okay, which part of the question are you finding difficult?
Isach Stevik
1,154 PointsHow the code is going to look.
Ed H-P
2,728 PointsEd H-P
2,728 PointsHi Isach,
Would you post the question text too please?