top of page

Python Program using function to calculate addition, substraction, multiplication and division

def add(a,b):

print("Addition of two numbers", a+b)

def sub(a,b):

print("Subtraction of Two numbers",a-b)

def mul(a,b):

print("Multiplication of two numbers", a*b)

def div(a,b):

print("Division of two numbers",a/b)

x=int(input("Enter first numbers: "))

y=int(input("Enter Second numbers: "))






Enter first numbers: 5

Enter Second numbers: 8

Addition of two numbers 13

Subtraction of Two numbers -3

Multiplication of two numbers 40

Division of two numbers 0.625

To check even or odd number using function

def even(a):

if a%2==0:

print("Number is even")


print("Number is odd")

x=int(input("Enter a Number: "))



Enter a Number: 12

Number is even

703 views0 comments

Recent Posts

See All

Write a Python function to calculate the factorial of a number (a non-negative integer). The function accepts the number as an argument. This program is most for O Level Practical Exam so read it care

This program is most for O Level Practical Exam so read it carefully. Program: import numpy as np x = np.array([1,2,3,4,5,7,2,1,1,1,8,9,1]) print(x) print("most frequent value in the list:") print(np.

bottom of page