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 Sequences Sequence Iteration Iterating over Ranges

Abigail Solomon
seal-mask
.a{fill-rule:evenodd;}techdegree
Abigail Solomon
Data Analysis Techdegree Student 4,410 Points

Type Error when writing iterable range loop. Bummer: TypeError: list.append() takes exactly one argument (0 given)

I'm wondering what I'm doing wrong to receive this Type Error, could anyone please check this out and let me know what's going on. I thought I placed the my_list.append in the body of the loop where it belongs.

iterating_ranges.py
my_list = []

for val in range(0, 10, 1):
    my_list.append()

1 Answer

Steven Parker
Steven Parker
241,488 Points

That message "list.append() takes exactly one argument (0 given)" is telling you that the method needs to have an argument, but it's missing.

Also, the instructions said, "To append a value to a list, use the syntax my_list.append(val)" :point_left: note the argument.

Just put val in as the argument and you should pass.