In Python, you can filter a list comprehension by adding an if statement to the end, e.g.:

[x for x in list if x<y]

I wish you could do the same in a for loop, e.g.:

for x in list if x<y:
...print(x)

5 favourites 0 retweets

View this tweet on twitter.com

This tweet as JSON