Commit 6f2fb51f by logesh.n

added perimeter.py file

parent 8b6b7338
try: print("Calculate perimeter and area of the following shapes given in the list")
x =10 print("\n1) Rectangle\n2) Square\n3) Circle\n")
y =10
print(x) option = input("Type ''pr'' to calculate the perimeter of rectangle and ''ar'' to calculate the area of the rectangle\n"
print(x+y) "Type ''ps'' to calculate the perimeter of square and ''as'' to calculate the area of the"
except NameError: "square\nType ''pc'' to calculate the perimeter of circle and ''ac'' to calculate the area of the circle "
print("not defined") ">> ")
except:
X =10 if option == "pr":
Y=10 print("\nDo you want to calculate the perimeter of Rectangle? ")
print("an exception error", X+Y) confirm = (input("type ''y'' to continue and ''n'' to stop >> "))
finally: if confirm == "y":
print("no errors") length = int(input("\nenter the length of the rectangle >> "))
\ No newline at end of file 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