From bac5ba37130f39cda4e81e3cd7938ffb3adbdc9d Mon Sep 17 00:00:00 2001 From: Ethan-Liu301 Date: Sun, 6 Oct 2024 20:21:08 -0700 Subject: [PATCH] Update 1002.py --- scripts/1002.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/scripts/1002.py b/scripts/1002.py index 709b5b3..7008435 100644 --- a/scripts/1002.py +++ b/scripts/1002.py @@ -1,3 +1,8 @@ -r = float(input()) -a = (r * r) * 3.14159 -print("A=%0.4f" %a) +while True: + try: + r = float(input("Give me any radius and I will calculate the circle's area: ")) + a = (r * r) * 3.14159 + print("A=%0.4f" % a) + break # Exit the loop if the input is valid + except: + print("Please enter an actual number.")