Created
April 30, 2020 21:07
-
-
Save amandaroos/d6695efc3cd2934eae3e13bd82905116 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#n is generations, m is pairs of rabbits born per litter | |
#b is pairs of baby bunnies, B is pairs of adult bunnies | |
def get_rabbits(n,m): | |
if n == 1: | |
return 1, 0 | |
else: | |
b, B = get_rabbits(n-1, m) | |
return(B*m, B + b) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment