This is related to my other Kata about cats and dogs.

# Kata Task

I have a cat and a dog which I got as kitten / puppy.

I forget when that was, but I do know their current ages as `catYears` and `dogYears`.

Find how long I have owned each of my pets and return as a list [`ownedCat`, `ownedDog`]

NOTES:
* Results are truncated whole numbers of "human" years

## Cat Years

* `15` cat years for first year
* `+9` cat years for second year
* `+4` cat years for each year after that

## Dog Years

* `15` dog years for first year
* `+9` dog years for second year
* `+5` dog years for each year after that



**References**

* http://www.catster.com/cats-101/calculate-cat-age-in-cat-years
* http://www.slate.com/articles/news_and_politics/explainer/2009/05/a_dogs_life.html

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Starter code: def owned_cat_and_dog(cat_years, dog_years):
	

Solutions:
def owned_cat_and_dog(cy, dy):
	cat = 0 if cy < 15 else 1 if cy < 24 else 2 + (cy - 24) // 4
	dog = 0 if dy < 15 else 1 if dy < 24 else 2 + (dy - 24) // 5
	return [cat, dog]


def owned_cat_and_dog(cat_years, dog_years):
	i = cat_years
	k = dog_years
	if i < 24:
		cat_years = 1
	if k < 24:
		dog_years = 1
	if i == 24:
		cat_years = 2
	if k == 24:
		dog_years = 2
	if i > 24:
		cat_years = int((i - 24) / 4) + 2
	if k > 24:
		dog_years = int((k - 24) / 5) + 2
	if i < 15:
		cat_years = 0
	if k < 15:
		dog_years = 0
	return [cat_years, dog_years]


def owned_cat_and_dog(cat, dog):
	return [years(cat, 4), years(dog, 5)]

def years(a, m):
	return 2 + (a - 24) // m if a >= 24 else 1 if a >= 15 else 0


def owned_cat_and_dog(cat_years, dog_years):
	(c, d) = (0, 0)
	if cat_years < 15:
		c = 0
	elif 15 <= cat_years < 24:
		c = 1
	elif cat_years == 24:
		c = 2
	else:
		c = (cat_years - 24) // 4 + 2
	if dog_years < 15:
		d = 0
	elif 15 <= dog_years < 24:
		d = 1
	elif dog_years == 24:
		d = 2
	else:
		d = (dog_years - 24) // 5 + 2
	return [c, d]


def owned_cat_and_dog(cat, dog):
	import math
	return list(map(math.floor, [cat / 15 if cat < 24 else (cat - 16) / 4, dog / 15 if dog < 24 else (dog - 14) / 5]))


def owned_cat_and_dog(cat_years, dog_years):
	h1 = (cat_years > 14) + (cat_years > 23) + max(0, (cat_years - 24) // 4)
	h2 = (dog_years > 14) + (dog_years > 23) + max(0, (dog_years - 24) // 5)
	return [h1, h2]


def owned_cat_and_dog(cat_years, dog_years):
	cat = cat_years
	dog = dog_years
	count_cat = 1
	count_dog = 1
	if cat > 24:
		while cat > 24:
			cat -= 4
			count_cat += 1
		human_cat = cat / 24 + count_cat
	elif cat == 24:
		human_cat = 2
	elif cat < 24 and cat >= 15:
		human_cat = 1
	else:
		human_cat = 0
	if dog > 24:
		while dog > 24:
			dog -= 5
			count_dog += 1
		human_dog = dog / 24 + count_dog
	elif dog == 24:
		human_dog = 2
	elif dog < 24 and dog >= 15:
		human_dog = 1
	else:
		human_dog = 0
	return [int(human_cat), int(human_dog)]


import math

def owned_cat_and_dog(c, d):
	return [0 if c < 15 else 1 if 15 <= c < 24 else 2 if c == 24 else math.floor((c - 24) / 4 + 2), 0 if d < 15 else 1 if 15 <= d < 24 else 2 if d == 24 else math.floor((d - 24) / 5 + 2)]


def owned_cat_and_dog(cat_years, dog_years):
	cat = 0 if cat_years < 15 else 1 if cat_years < 24 else (cat_years - 16) // 4
	dog = 0 if dog_years < 15 else 1 if dog_years < 24 else (dog_years - 14) // 5
	return [cat, dog]


def owned_cat_and_dog(cat_years, dog_years):
	f = lambda y, n: 0 if y < 15 else 1 if y < 24 else 2 + (y - 24) // n
	return [f(cat_years, 4), f(dog_years, 5)]