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

David Lassen-Diesen
David Lassen-Diesen
184 Points

Strings and Numbers

Hi, I'm hoping to get some help on the refresher question regarding strings and numbers.I'm returning to this track after a few weeks away and just need a reminder of how to write the code.

The question is create a single new list variable named, my list.Then put three numbers and two strings into it,in whatever order you want.For the last member,though,add another list with two items in it.

Thank you David

lists.py
my_list

5 Answers

Hi David,

The reason that your code isn’t working is that you ended your list with a period (.) and a curly brace (}). Lists have to be ended and started with brackets (]), like Grigorij did in his first answer. So you don’t need the period, and just need to replace the curly brace with a bracket. Then, your code should work. Hopefully that helps!

Grigorij Schleifer
Grigorij Schleifer
10,365 Points

Hey David, delxinowilsondebriano is absolutely right! Try it without the curly brace } and replace the period with a hard bracket ]

Let us know if that solved it

Grigorij Schleifer
Grigorij Schleifer
10,365 Points

Hi David,

use this one:

# a list can hold different data structures and even lists 
my_list = [1,2,3, 'David', 'Lassen-Diesen', [4,5]]

Does it help?

David Lassen-Diesen
David Lassen-Diesen
184 Points

a list can hold different data structures and even lists

my_list = [1,2,3, 'David', 'Lassen-Diesen', [4,5] .}

Hi unfortunately it won't accept the above on my computer.

David Lassen-Diesen
David Lassen-Diesen
184 Points

Hi Grigorij,

Thank you for your help, unfortunately the code is still not working,even if you copy and paste.

Regards,

David

Grigorij Schleifer
Grigorij Schleifer
10,365 Points

Hey David, sorry for the delay. This is weird, I copied the code chunk and it was working fine :sunglasses:

David Lassen-Diesen
David Lassen-Diesen
184 Points

Hi Grigorij,

I've copied and pasted the code chunk below and I get the following message;

a list can hold different data structures and even lists my_list = [1,2,3, 'David', 'Lassen-Diesen', [4,5]]

Bummer: Didn't find my_list

!, hope this helps.

Regards,

David

Grigorij Schleifer
Grigorij Schleifer
10,365 Points

Hmm, weird ... can you type it out? I tried it several times and it was working fine ... maybe restart the browser and try again ...