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 trialSam Issermoyer
4,300 PointsBummer: AssertionError: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] != 9 : Whoops, looks like my_list contains incorrect values or is
Little lost on appending the value
my_list = []
for my_list in range(10):
print(my_list)
1 Answer
Steven Parker
231,236 PointsThe instructions gave you the code for adding to the list when they said "To append a value to a list, use the syntax my_list.append(val)
." That example assumes that the list variable will be named "val", which would give you:
my_list = []
for val in range(10):
my_list.append(val)
And you don't need to "print" anything for this challenge.
Daniel Adari
3,577 PointsDaniel Adari
3,577 PointsAs I understand from your question, you want to append the number from 0 to 9 (inclusive) to
my_list
.My solution: