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!
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
String refresher. Trying to remember how to add a list of two items into a list.
not sure whether i should do it directly inside the first list or append it into the original list on another line. it wasnt technically covered just directly placing a list inside of another one
my_list = ['1', '2', '3', 'number', 'letter', ['string', 'strings']]
Kyle Petran5,017 Points
I think this question really depends on what you're trying to accomplish. I believe a .append function would be something you might use to add something to an already existing list; however, if the list element that you want to add to your list is needed at the time of declaration then you would declare the variable the way you did so above. Hope this helps.