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

Alan Kuo
Alan Kuo
7,697 Points

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

Question: 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.

I am struggling with this one

my code1:

my_list = ["1", "2", "3", "apple", "banana"] my_list2 = ["grape", "mango"] my_list.append(my_list2)

my code2:

my_list = ["1", "2", "3", "apple", "banana"] my_list2 = ["grape", "mango"] my_list.insert(4, my_list2)

my code3:

my_list = ["1", "2", "3", "apple", "banana"] my_list2 = ["grape", "mango"] my_list += my_list2

NONE of the above worked.

lists.py
my_list = ["1", "2", "3", "apple", "banana"]
my_list2 = ["grape", "mango"]
my_list += my_list2
Jake Kobs
Jake Kobs
9,215 Points

Close! All you need to do is remove the quotation marks around the numerical values. When you put quotes around them, they become strings.

2 Answers

Mohamed Ali
Mohamed Ali
2,923 Points

my_list = [1, 2, 3, "apple", "banana"] my_list2 = ["grape", "mango"] my_list += my_list2 I tried this answer but still now working

Alan Kuo
Alan Kuo
7,697 Points

Thank you Jake Kobs, I solved the problem.