Commit 3dec1ced by adith.s

Add new file

parents
def add(a, b):
"""
Function to add two numbers
:param a: First value
:param b: Second value
:return: return the value of Addition
"""
return a + b
def sub(a, b):
"""
function to subtract two numbers
:param a: First value
:param b: Second Value
:return: returns the value of subtraction
"""
if a > b:
"""A condition is checked whether first number is greater to avoid negative values
if first number is greater then subtraction is done
"""
d = a - b
return d
else:
print("First number should be Greater")
def mul(a, b):
"""
:param a: First value
:param b: second value
:return: returns the product
"""
return a * b
def div(a, b):
"""
:param a: First value
:param b: Second Value
:return: the quotient and remainder is got
"""
if b == 0:
print("Zero divison cannot be done")
else:
f = a / b
print("The Quotient is ", f)
g = a % b
print("The remainder is", g)
a = True
while a:
a = int(input("enter first number"))
b = int(input("enter second number"))
print(" Please Select the operation")
print("1.Addition")
print("2.Subtraction")
print("3.Multiplication")
print("4.Divison (Quotient and Remainder)")
print("Choose Your Option")
z = int(input())
if z == 1:
print("The Sum is", add(a, b))
elif z == 2:
print("The difference is", sub(a, b))
elif z == 3:
print("The Product is ", mul(a, b))
elif z == 4:
(div(a, b))
s = input("do you want to exit?(yes or no)")
if ( s == "yes"):
a = False
elif(s == "no"):
a = True
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment