11/18 Problem


Getting the error "Oops, try again. It looks like your list for odds is [[1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21]] instead of [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21]." How can I remove the second pair of brackets in my result? Is there an easier way to do this?

Replace this line with your code. 
to_21 = range(1,22)

odds = []

numbers = to_21[::2]


middle_third = []

numbers2 = to_21[8:14:1]



Okay, you could remove the double square brace by simplifying things down for the odds like this:

odds = to_21[::2]

print odds

And I observed that you will have the same scenario with middle_third. So, do this, also:

middle_third = to_21[8:14:1]

print middle_third


Oh so you do not have to make a new list and append a value to it you can just make the list equal to_21[::2]


Yes, exactly. That was just you creating an empty list and appending another list.

Let's say I tried "minifying" things down. :slight_smile:


yep that seemed to work thank you!


You're welcome.

Have fun coding! :slight_smile:


i had to use to_21[7:14:1]
print middle_third
just saying


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