2021-08-13 11:44:51 +05:30

27 lines
858 B
Python

# mypkgmain1.py with main function
from masifutil import mycalculator as calc
from masifutil import myrandom as rand
from masifutil.advcalc import advcalculator as acalc
def my_main():
""" This is a main function which generates two random numbers and then apply calculator functions on them """
x = rand.random_2d()
y = rand.random_1d()
sum = calc.add(x,y)
diff = calc.subtract(x,y)
sroot = acalc.sqrt(x)
log10x = acalc.log(x)
log2x = acalc.ln(x)
print("x = {}, y = {}".format(x, y))
print("sum is {}".format(sum))
print("diff is {}".format(diff))
print("square root is {}".format(sroot))
print("log base of 10 is {}".format(log10x))
print("log base of 2 is {}".format(log2x))
""" This is executed only if the special variable '__name__' is set as main"""
if __name__ == "__main__":
my_main()