Commit 6f2fb51f by logesh.n

added perimeter.py file

parent 8b6b7338
try:
x =10
y =10
print(x)
print(x+y)
except NameError:
print("not defined")
except:
X =10
Y=10
print("an exception error", X+Y)
finally:
print("no errors")
\ No newline at end of file
print("Calculate perimeter and area of the following shapes given in the list")
print("\n1) Rectangle\n2) Square\n3) Circle\n")
option = input("Type ''pr'' to calculate the perimeter of rectangle and ''ar'' to calculate the area of the rectangle\n"
"Type ''ps'' to calculate the perimeter of square and ''as'' to calculate the area of the"
"square\nType ''pc'' to calculate the perimeter of circle and ''ac'' to calculate the area of the circle "
">> ")
if option == "pr":
print("\nDo you want to calculate the perimeter of Rectangle? ")
confirm = (input("type ''y'' to continue and ''n'' to stop >> "))
if confirm == "y":
length = int(input("\nenter the length of the rectangle >> "))
breadth = int(input("enter the breadth of the rectangle >> "))
radius = int(input("enter the radius of the rectangle >> "))
elif confirm == "n":
print("try again")
No preview for this file type
from scripts.constants.constant import PI
from app import length, breadth, radius
class Perimeter:
def __init__(self, length1, breadth1, radius1):
self.length1 = length1
self.breadth1 = breadth1
self.radius1 = radius1
def rectangle(Perimeter):
final_perimeter = 2 * (Perimeter.length1 + Perimeter.breadth1)
print("Perimeter of the Rectangle >> ", final_perimeter)
peri_of_circle = Perimeter(length, breadth, radius)
peri_of_circle.rectangle()
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