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 331 views
2 answers 337 views
337 views asked Mar 4, 2016 by avibootz
1 answer 211 views
1 answer 325 views
1 answer 318 views
...