For One and All


#1

Hi,
This is my code:

my_list = [1,9,3,8,5,7]

for number in my_list:
return 2 * number

Why doesn’t this work, but when I use print instead of return it does ? cheers


#2

return can only be used inside functions.


#3

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