Getting every odd variable in a list?

Posted by John on Stack Overflow See other posts from Stack Overflow or by John
Published on 2009-11-23T02:03:21Z Indexed on 2010/06/02 11:44 UTC
Read the original article Hit count: 159

Filed under:

If I make a list in Python and want to write a function that would return only odd numbers from a range 1 to x how would I do that?

For example, if I have list [1, 2, 3, 4] from 1 to 4 (4 ix my x), I want to return [1, 3].

© Stack Overflow or respective owner

Related posts about python