Making a calculator through function in Python
So we are going to discuss function through the calculator example.
#Calculator in python using function
def addition():
print("Enter the first number\n")
a=int(input())
print("Enter the second number\n")
b=int(input())
print("\nThe sum of two number:",a+b)
def Substranction():
print("Enter the first number\n")
a=int(input())
print("Enter the second number\n")
b=int(input())
print("\n The Substranction of two numbers",a-b)
def multiplication():
print("Enter the first number\n")
a=int(input())
print("Enter the second number\n")
b=int(input())
print("\n The multiplication of two numbers",a*b)
def division():
print("Enter the first number\n")
a=int(input())
print("Enter the second number\n")
b=int(input())
print("\n The division is:",a/b)
addition()
Output:-
Comments
Post a Comment