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

This challenge is just meant as a refresher. Create a single new list variable named my_list. Put 3 numbers and 2 string

This challenge is just meant as a refresher. 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.

where am i going wrong, i know I'm missing the last set of instructions but i feel like i should know how to add this by now..and im a little stumped

lists.py
my_list = ('1', '2', '3', "I love python", "Teach me more" # i believe the last instruction goes here, but no idea how to write it))

3 Answers

Mohammad Usman
Mohammad Usman
5,969 Points

Ok it seems you're doing a number of things wrong. First you've created a tuple and not a list . In python a list is created using the square brackets '[]'. Secondly, in python '1' is not an integer but is in fact treated as a string. Thirdly, for the last step , it's asking you to write a list within a list. Therefore your code should look more like this:

 my_list = [1 , 2, 3, 'hello', 'world', ['hello', 'again']]

Hello, I would like to know why in a list or should I say in this one in particular the numbers do not have quotes but the words hello and word do. Thank you.

I see where I went wrong, thank you!

this was my end result,

my_list = [ 1, 2, 3, "I love python", "Teach me more!!", [ "this one was tricky", "Thank you Mohammad for your help"]]

my_list = [1 , 2, 3, 'hello', 'girl', ['hello', 'again']]