User Define Module
Most frequently used function can be defined in a user defined module to make its re-use smoothly.
Program 1
def addition(a,b): print(a+b) def subtract(a,b): print(a-b) def multiply(a,b): print(a*b) def division(a,b): print(a/b)
This file was saved as a cal.py.
import cal a=int(input("Enter First Number")) b=int(input("Enter Second Number")) cal.addition(a,b) cal.division(a,b) cal.subtract(a,b) cal.multiply(a,b)
In the second program we only have to import the file and call the function line by line which is define previously.
Output
Enter First Number55 Enter Second Number55 110 1.0 0 3025