How Old is Your Cat?

catIn this challenge we are going to create a cat’s age convertor find out how old a cat is in “human years”. This is very useful to understand more about cats and the care they need and to find out at what stage of life a cat is.

To convert the age of a cat in human years you have to do the following:

  • Year 1 counts for 15 Human Years
  • Year 2 counts for 9 Human Years
  • Thereafter each year counts for 4 Human Years

For example:

  • A 1 year old cat is 15 Human Years old,
  • A 2 years old cat is 15 + 9 = 24 Human Years old,
  • A 3 years old cat is 15 + 9 + 4 = 28 Human Years old,
  • A 4 years old cat is 15 + 9 + 4 + 4 = 32 Human Years old,
  • A 5 years old cat is 15 + 9 + 4 + 4 + 4= 36 Human Years old,
  • A 10 years old cat is 15 + 9 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 = 56 Human Years old.

You can check the full cat’s age conversion chart at the bottom of this post.

Your Challenge


Complete the following code to ask the user to input the age of a cat in years and return the equivalent in human years.

Extension #1


Amend your code so that it also works for cats under 1 year old. In this case you will have to ask for the cat’s age in months and use the conversion chart below (At the bottom of this post) to return the cat’s age in human years.

Extension #2


The stages of life of a cat are as follows:

  • Kitten – from birth to 6 months,
  • Junior – from 7 months to 2 years,
  • Prime – from 3 years to 6 years,
  • Mature – from 7 years to 10 years,
  • Senior – from 11 years to 14 years,
  • Geriatic – from 15 years above.

Extend your code to tell the end-user what stage of life their cat’s age is corresponding to.

Extension #3


Create another program where the user enters their age in human years and the program tells the user how old they would be if they were a cat!

Cat’s age conversion chart:

Life Stage Cat years Human years
Kitten2 months9 to 10 months
3 months2 to 3 years
4 months5 to 6 years
5 months8 to 9 years
6 months10 years
Junior8 months13 years
1 year15 years
2 years24 years
Prime3 years28 years
4 years32 years
5 years36 years
6 years40 years
Mature7 years44 years
8 years48 years
9 years52 years
10 years56 years
Senior11 years60 years
12 years64 years
13 years68 years
14 years72 years
Geriatric15 years76 years
16 years80 years
17 years84 years
18 years88 years
19 years92 years
20 years96 years
21 years and above100 years
Share Button
Posted in Computer Science, Python - Intermediate, Python Challenges Tagged with: ,

Our Latest Book

Follow this blog