I've just started to learn the long-heard python language. I've been working with C before. And I find python, as a modern script language is much concise on various tasks.
So I was wondering, if I have a list foo = [1, 2, 3, 4, 5]
, and I want to pick all the odd numbers out of it into bar
. In C, I might use a loop and check each number in foo
and copy the elements needed into bar
. What do you guys do this "python-style"?