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

i need help

I really need help this ain't working

iterating_ranges.py
my_list = [] 
for val in range(10): 
    print(my_list.append(val))
Chris Freeman
Chris Freeman
Treehouse Moderator 68,423 Points

The code above passes the challenge. What error are you seeing?

Chris Freeman
Chris Freeman
Treehouse Moderator 68,423 Points

The print surrounding the append statement is not needed.

2 Answers

Steven Parker
Steven Parker
229,644 Points

It passes the challenge for me just as it is, even with the spurious "print" statement. But as Chris mentioned, the "print" isn't needed here.

Chris Freeman
Chris Freeman
Treehouse Moderator 68,423 Points

I would add that the print outputs nothing but a blank line since the list.append method returns None.

Dawlat Abdul
Dawlat Abdul
4,606 Points

You are trying both to append the value and print it that's why aint working.

try this:

my_list = [] for val in range(10): my_list.append(val) print(my_list[val])