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

Python Python Collections (2016, retired 2019) Lists Creating lists

Isach Stevik
Isach Stevik
1,154 Points

Help me!!

what I am supposed to do?

lists.py

Hi Isach,

Would you post the question text too please?

3 Answers

Sorry 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
Isach Stevik
1,154 Points

ho, 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.

Thanks! Okay, which part of the question are you finding difficult?

Isach Stevik
Isach Stevik
1,154 Points

How the code is going to look.