home
Learn
screen_rotation
mylist = [100,200,300,400,500] newlist = [] for item in mylist: if item > 200: newlist.append(item) print(newlist) # create a new list using comprehension mylist = [100,200,300,400,500] newlist = [item for item in mylist if item > 200] print(newlist)
Program Output
[300, 400, 500] [300, 400, 500]