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

Alejandro Byrne
Alejandro Byrne
2,562 Points

Ummmmm... bug?

I can't seem to put the right amount of items in the list... I've tried different options, and they don't work. The error says "Bummer! hmm, didn't find the right amount of items in the list, there should be 6", even thought the instructions say to put 5...

lists.py
my_list = [2, 3, "Hi", 7, "PPAP"]

2 Answers

andren
andren
28,558 Points

The instructions for this challenge is worded somewhat confusingly, but what they are actually telling you to do is:

  1. Make a list

  2. Add 3 numbers and two strings to this list

  3. As the last item in the list (item 6) add a list that contains two items.

In other words you are meant to end up with a list that has another list nested within it as the sixth item.

You have completed part 1 and 2 in your solution, the only thing you need to do to complete the task is to add a list containing two items (which can be whatever you want) as the last item in the list.

Alejandro Byrne
Alejandro Byrne
2,562 Points

Alright thanks! I guess I really didn't read correctly... Sorry bout that. Didn't even know you could put a list in a list. Thanks!

This is done by creating.

my_list = [4, 6, 8, "home", "fun"] list_2 = [5, "Happy"] my_list.append(list_2)

Please don't provide the solution directly without explanation on code. Nobody can learn programming by just coping-and-pasting code. They actually have to learn how the code's working and learn to code on their own. If you never coded on your own, you will never remember important things. For example I once took the C# courses and now I almost forgot all of the meat.

Instead, you should either provide descent hints that will drive the person with errors in the right direction or providing the code and explaining it step-by-step. Although both are okay, I noticed that providing hints is better than providing the code and explaining it step-by-step, since it encourages the user to try on their own.

A great answer example is shown above what Andren wrote. I think his answer is a wonderful example for a descent answer :smile:

Congrats andren for making such wonderful posts!