From 2155bf67dc63d26bdf464e25e7ead7190d4cbb8c Mon Sep 17 00:00:00 2001 From: admin Date: Thu, 19 Dec 2024 23:00:42 +0530 Subject: [PATCH 1/2] modify --- app.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 app.py diff --git a/app.py b/app.py new file mode 100644 index 0000000..c68e85a --- /dev/null +++ b/app.py @@ -0,0 +1,16 @@ +import math + +def calculate_circle_area(radius): + """Calculate the area of a circle given its radius.""" + return math.pi * radius ** 2 + +# Get input from the user +print("Welcome to the Circle Area Calculator!") +radius = float(input("Enter the radius of the circle: ")) + +# Calculate the area +if radius < 0: + print("Radius cannot be negative. Please enter a valid number.") +else: + area = calculate_circle_area(radius) + print(f"The area of the circle with radius {radius} is {area:.2f}.") From d2613a8c3f67c25560bf075a6602d1339a64595e Mon Sep 17 00:00:00 2001 From: admin Date: Thu, 19 Dec 2024 23:10:16 +0530 Subject: [PATCH 2/2] perfect --- app.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/app.py b/app.py index c68e85a..e11900b 100644 --- a/app.py +++ b/app.py @@ -7,10 +7,3 @@ def calculate_circle_area(radius): # Get input from the user print("Welcome to the Circle Area Calculator!") radius = float(input("Enter the radius of the circle: ")) - -# Calculate the area -if radius < 0: - print("Radius cannot be negative. Please enter a valid number.") -else: - area = calculate_circle_area(radius) - print(f"The area of the circle with radius {radius} is {area:.2f}.")