Contents
Use a for comprehension to filter out values, not a for loop.
1nums = [] 2for i in range(100): 3 if i % 2 == 0: 4 nums.append(i)
1nums = [i for i in range(100) if i % 2 == 0]