Ask a Genie – Python Algorithm -1

Write a Python code in the comment and submit your answer

A dog that is 5 years old is equivalent to a 42-year-old human. You need to write a Python program that converts the age of a dog to the equivalent age of a human.

Write a Python code which:

-Asks for the age of the dog in years

-If the age is 2 or less, the human equivalent is 12 times the age

-If the age is 2 more than 2, the human equivalent is 24 for the first 2 years, plus 6 for every additional year

Leave a Reply

Your email address will not be published. Required fields are marked *

Was this article helpful?
YesNo

Leave a Reply

Your email address will not be published. Required fields are marked *