Create a user defined module with simple functions for: addition, subtraction, multiplication, division, modulo, square, factorial. Write a program to import the module and access functions defined in the module in python


create and
# create add, sub, mul, div, mod, square, factorial

def add(a, b):
return a + b

def sub(a, b):
return a - b

def mul(a, b):
return a * b

def div(a, b):
return a / b

def mod(a, b):
return a % b

def square(a):
return a * a

def factorial(a):
if a == 0:
return 1
return a * factorial(a - 1)

import mymath

print(mymath.add(1, 2))
print(mymath.sub(1, 2))
print(mymath.mul(1, 2))
print(mymath.div(1, 2))
print(mymath.mod(1, 2))