9/8. For One and All


Hello I am having trouble with this lesson of doing the for loop exercise.


The error that keeps coming up with is this: "Oops, try again. It looks like your loop did not print 2!"

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

for number in my_list:
    # Your code here
    times_two.append(2 * number)
print times_two

Can anyone please help me please?


The exercise doesn't ask you to go into this much detail..?

Write a statement in the indented part of the for-loop that prints a number equal to 2 * number for every list item.

my_list = [1,9,3,8,5,7]
times_two = []  #not needed

for number in my_list:
    times_two.append(2 * number) #just print number multiplied by 2
print times_two #nothing needed here


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

for number in my_list:
    print 2 * number

Don't overcomplicate things for yourself! :stuck_out_tongue:


Thanks for the help
It worked
And next time I will make sure that i won't overcmplicate my self! :smiley: