Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,855 questions

51,776 answers

573 users

How to use arithmetic operators as functions in Python

1 Answer

0 votes
from operator import *

a = 5
b = 2    


print('add(a, b):', add(a, b))     
print('sub(a, b):', sub(a, b))     

print('floordiv(a, b):', floordiv(a, b))     
print('truediv(a, b):', truediv(a, b))  

print('mod(a, b):', mod(a, b))     
print('mul(a, b):', mul(a, b))     

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




'''
run:

add(a, b): 7
sub(a, b): 3
floordiv(a, b): 2
truediv(a, b): 2.5
mod(a, b): 1
mul(a, b): 10
pow(a, b): 25

'''

 



answered May 30, 2019 by avibootz

Related questions

1 answer 155 views
1 answer 149 views
1 answer 144 views
1 answer 167 views
1 answer 97 views
97 views asked Oct 11, 2022 by avibootz
1 answer 154 views
154 views asked Jan 9, 2016 by avibootz
...