Skip to content

Instantly share code, notes, and snippets.

@harmo
Created February 2, 2017 11:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save harmo/427c39de23be135c306126c9d1e19a40 to your computer and use it in GitHub Desktop.
Save harmo/427c39de23be135c306126c9d1e19a40 to your computer and use it in GitHub Desktop.

Consider having a cow that gives a child every year from her fourth year of life on and all her subsequent children do the same.

After n years how many cows will you have?

count_cows(0)  # should equal 1
count_cows(1)  # should equal 1
count_cows(3)  # should equal 2
count_cows(4)  # should equal 3
count_cows(10)  # should equal 28

Return None if n is not an integer.

Note: Assume all the cows are alive after n years.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment