How to use abs, positive negative operators as functions in Python

1 Answer

0 votes
from operator import *
 
a = -2
b = 3.14    
 
 
print('abs(a):', abs(a)) 
print('abs(b):', abs(b))  

print('neg(a):', neg(a))     
print('neg(b):', neg(b))     

print('pos(a):', pos(a))     
print('pos(b):', pos(b))
 
 
 
'''
run:
 
abs(a): 2
abs(b): 3.14
neg(a): 2
neg(b): -3.14
pos(a): -2
pos(b): 3.14
 
'''

 



answered May 30, 2019 by avibootz
edited May 30, 2019 by avibootz
...