How to use truth() logical operation to return true if obj is true in Python

1 Answer

0 votes
from operator import *      

a = 1
print(truth(a))  # if obj is true

a = 0
print(truth(a))  # if obj is true

a = -1
print(truth(a))  # if obj is true



'''
run:

True
False
True

'''

 



answered May 30, 2019 by avibootz

Related questions

1 answer 342 views
2 answers 348 views
348 views asked Mar 4, 2016 by avibootz
1 answer 216 views
1 answer 332 views
1 answer 327 views
...