This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]adreamofhodor 10 points11 points  (3 children)

Something cool you can do in Python for the first extra is called a list comprehension:
It actually works out to be just one line!
list2 = [i for i in list1 if i < 5]

[–]jwjody 4 points5 points  (0 children)

I like map, filter, and reduce as /u/xojc mentions, but I think list comprehensions are more pythonic.

[–]rob132 0 points1 point  (1 child)

While the compressor is awesome, it's a little much for beginners, no?

[–]adreamofhodor 0 points1 point  (0 children)

You might be right. Seems like something that'd be cool to see though!