[8.For one and all] Q about printing order


#1

I wrote like below,


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

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

expecting the result will be like,

1
18
6
16
10
14
1
729
27
512
125
343
None

but, the result was

2
1
18
729
6
27
16
512
10
125
14
343
None

Q. Why?
Q. How can I create the order I wanted?


#2

Someone from other community helped me to solve it as below.
The key was to make two for loops, not two printings in a row.

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

for number in my_list:
    print 2 * number
for number in my_list:
    print number**3

2
18
6
16
10
14
1
729
27
512
125
343
None