Commit e24d6d1b by arun.uday

new file structure v1

parent dc372652
# Importing modules rectangle, circle, square from scripts # Importing modules rectangle, circle, square from scripts
from scripts import Rectangle from scripts.core import Circle, Rectangle, Square
from scripts import Circle
from scripts import Square
# User Inputs # User Inputs
while True: while True:
...@@ -48,5 +46,6 @@ while True: ...@@ -48,5 +46,6 @@ while True:
else: else:
print("Please check the spelling.....") print("Please check the spelling.....")
# invalid calculation choice
if error == 1: if error == 1:
print("Calculation choice error....") print("Calculation choice error....")
# value of pi
pi = 3.14
# import pi from constant
from scripts.constants import values
# class for shape circle # class for shape circle
class Circle: class Circle:
def __init__(self, circle_radius): def __init__(self, circle_radius):
...@@ -11,7 +14,7 @@ class Area(Circle): ...@@ -11,7 +14,7 @@ class Area(Circle):
def display_area(self): def display_area(self):
try: try:
return 3.14 * self.radius * self.radius return values.pi * self.radius * self.radius
except Exception as e: except Exception as e:
print(f'Exception occurred: {e}') print(f'Exception occurred: {e}')
...@@ -23,6 +26,6 @@ class Perimeter(Circle): ...@@ -23,6 +26,6 @@ class Perimeter(Circle):
def display_perimeter(self): def display_perimeter(self):
try: try:
return 2 * 3.14 * self.radius return 2 * values.pi * self.radius
except Exception as e: except Exception as e:
print(f'Exception occurred: {e}') print(f'Exception occurred: {e}')
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