I'm just doing a simple python exercise that looks like this:
list1 = [47, 48, 49, 50, 51, 52, 53, 54]
list2 = []
for num in list1:
if num >= 50:
list1.remove(num)
list2.append(num)
print(list1)
print(list2)
List 1 should only have numbers less than 50 and list 2 should have numbers greater than or equal to 50. However, the output says otherwise:
List1: [47, 48, 49, 51, 53]
List2: [50, 52, 54]
How can I fix this?