For One and All Error


For One and All

Oops, try again. It looks like your loop did not print 2!

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

for number in my_list:
    number = number * 2


number = number * 2

you assigned result in number variable but you had to print it too ?

If I have to print 4,I'd do this..

print 4


I done that:

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

for number in my_list:
square_list.append (number*2)

print square_list

This worked, but i am having the same error message


This was the result for square_list

[2, 18, 6, 16, 10, 14]


that makes things complicated and you'll go farther from right Answer/Solution
If you go back to instruction and read,it told you to print
double of number
(your first code is quite near to be exact,You just need to print the number ?)

Can you do this?

if a number is n

n = 4
print double of it using print ?


The solution for me was:

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

for number in my_list:
number = number * 2 # Your code here
print number

This worked. Thx a lot


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