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 240 views
2 answers 223 views
223 views asked Mar 4, 2016 by avibootz
1 answer 138 views
1 answer 235 views
1 answer 211 views
...