I've spent a good half an hour trying to figure out what's wrong, it's probably obvious



"Oops, try again. double_list([0, 1]) returned None. Did you remember to return the result? "

The code is supposed to double everything in a given list, and right now I get
which gives an error message.

Right now I have 'print n[i]'; 'return n[i]' gives a less correct answer.

n = [3, 5, 7]
def double_list(x):
    for i in range(0, len(n)):
        n[i] = n[i] * 2
        print n[i]
# Don't forget to return your new list!

print double_list(n)


if you need to return something, use the return keyword


Where your code says "print n[i]" should say "return" instead of print, and that should be spaced evenly with your "for" statement.


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