Lab–3–Functions in Python
In this last we are going to rewrite lab nuber 2 but using functions this time.
x = input(‘Enter the value of x = ‘)
y = input (‘Enter the value of y = ‘)
x = int (x)
y = int (y)
def Addition ():
Addition = x + y
print Addition
x = int (x)
y = int (y)
def substraction():
substraction = x – y
print substraction
x = int (x)
y = int (y)
def multiplication():
multiplication = x * y
print multiplication
x = int (x)
y = int (y)
def quotient ():
quotient = x / y
print quotient
x = int (x)
y = int (y)
def remaider ():
remainder = x % y
print remainder
x = int (x)
y = int (y)
#Display math
def math():
x != 0and y != 0
while (x != 0 and y != 0):
if x y:
print (‘x is greater than y’)
else:
print (‘x and y are equal’)
print x + y
print x – y
print x * y
print x % y
print x / y
x = input(‘Enter the value of x = ‘)
y = input (‘Enter the value of y = ‘)
x = int (x)
y = int (y)
Leave a Reply