for loop only loops 3 times. Why?… here is a solution to the problem.
for loop only loops 3 times. Why?
I wrote a deceptively simple loop. There are 6 items in the list, and it should loop six times. However, it only loops 3 times. Why?
list1 = 'one two three four five six'
newlist = list1.split(' ')
print (newlist)
list2 = ['seven', 'eight', 'nine', 'ten', 'eleven', 'twelve']
for number in list2:
nextnumber = list2.pop()
print ("Adding number ", nextnumber)
newlist.append(nextnumber)
print (newlist)