Sep-09-2017, 03:36 PM
def arec(l, b):
return l * b
def asq(s):
return s * s
def atri(h,b):
return (h*b)/2
def acir®:
return 3.14(r*r)
print("Select operation")
print("1.Area of Rectangle")
print("2.Area of Square")
print("3.Area of Triangle")
print("4.Area of Circle")
operation = input("Enter choice (1/2/3/4):")
#Parameters
length = int(input("Enter Length: "))
breadth = int(input("Enter Breadth: "))
side = int(input("Enter Side: "))
height = int(input("Enter Height: "))
base = int(input("Enter Base: "))
radius = int(input("Enter Radius: "))
height = int(input("Enter Height: "))
if operation == '1':
print("Area","=", arec(length,breadth))
elif operation == '2':
print("Area","=", asq(side))
elif operation == '3':
print("Area","=", atri(height,base))
elif operation == '4':
print("Area","=", acir(radius))
else :
print("Invalid Input")
My problem is that when i select a specific operation like area of circle i have to enter all parameters like height breadth
And also check it for other errors
return l * b
def asq(s):
return s * s
def atri(h,b):
return (h*b)/2
def acir®:
return 3.14(r*r)
print("Select operation")
print("1.Area of Rectangle")
print("2.Area of Square")
print("3.Area of Triangle")
print("4.Area of Circle")
operation = input("Enter choice (1/2/3/4):")
#Parameters
length = int(input("Enter Length: "))
breadth = int(input("Enter Breadth: "))
side = int(input("Enter Side: "))
height = int(input("Enter Height: "))
base = int(input("Enter Base: "))
radius = int(input("Enter Radius: "))
height = int(input("Enter Height: "))
if operation == '1':
print("Area","=", arec(length,breadth))
elif operation == '2':
print("Area","=", asq(side))
elif operation == '3':
print("Area","=", atri(height,base))
elif operation == '4':
print("Area","=", acir(radius))
else :
print("Invalid Input")
My problem is that when i select a specific operation like area of circle i have to enter all parameters like height breadth
And also check it for other errors