logical operators evaluation in return statemnet in python

Posted by table on Stack Overflow See other posts from Stack Overflow or by table
Published on 2010-05-19T11:48:29Z Indexed on 2010/05/19 11:50 UTC
Read the original article Hit count: 307

Filed under:

hi,

how does this execute:

**def f(x):

return x>0 and (x%2)+f(x/2) or 0**

x is an array ,for instanse,[1, 1, 1, 3]

thank u

© Stack Overflow or respective owner

Related posts about python