Create and access a user defined package ArithmeticPackage where the package contains a module named ArithmeticDemo, which inturn contains a method called sumtwo() , subtwo(), multwo() and divtwo() which takes two numbers as parameter and returns the result.

 def sumtwo(a,b):

    return a+b

def subtwo(a,b):

    return a-b

def multwo(a,b):

    return a*b

def divtwo(a,b):

    return a//b


from ArithmeticPackage import ArithmeticDemo
a=int(input("Enter the a value:"))
b=int(input("Enter the b value:"))
print("The addition of two numbers is",ArithmeticDemo.sumtwo(a,b))
print("The sub of two numbers is",ArithmeticDemo.subtwo(a,b))
print("The multiplication of two numbers is",ArithmeticDemo.multwo(a,b))
print("The division of two numbers is",ArithmeticDemo.divtwo(a,b))

Comments

Popular posts from this blog

Write a python program to compute cumulative product of a list of numbers (write function cumulative_product).

Write a Python program to compute distance between two points taking input from the user. Formula for Pythagorean theorem for compute distance between two points is: