From 54956ca9f60d5ec361a90a0af70170ca20204b0f Mon Sep 17 00:00:00 2001 From: AdyaTech Date: Thu, 7 May 2026 16:25:01 +0530 Subject: [PATCH] Contributing my Python project by the name of Dog Age Calculator in this repository. --- Dog-Age-Calculator/dogage.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 Dog-Age-Calculator/dogage.py diff --git a/Dog-Age-Calculator/dogage.py b/Dog-Age-Calculator/dogage.py new file mode 100644 index 0000000..19026bf --- /dev/null +++ b/Dog-Age-Calculator/dogage.py @@ -0,0 +1,15 @@ +def calculate_dog_age(human_age): + if human_age < 0: + return None + if human_age <= 2: + return human_age * 10.5 + return 21 + (human_age - 2) * 4 + + +human_age = int(input("Enter a dog's age in human years: ")) +dog_age = calculate_dog_age(human_age) + +if dog_age is None: + print("Age must be a positive number.") +else: + print(f"The dog's age in dog years is {dog_age}.") \ No newline at end of file