8. Omitting indices - code correct, but doesn't work


Here's a link to the exercise:

My code:

my_list = range(1, 11) # List of numbers 1 - 10

# Add your code below!
 print my_list[::2]

This is the error I get from the console:

File "python", line 4
print my_list[::2]
IndentationError: unexpected indent

This is what it says at the bottom:

Oops, try again. Did you accidentally delete the my_list list? Reset your code to try again.

I looked at other Q&As to this exercise and all of them worked using this code. I don't know what I did wrong.


print needs to be all the way on the left. Python uses something called whitespace. Take the space out of the beginning of the print line.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.