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

27 lines
846 B
Python

# mypkgmain0.py with absolute imports
import masifutil.mycalculator as calc
import masifutil.myrandom as rand
import masifutil.advcalc.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()