Skip to content

Instantly share code, notes, and snippets.

@Demandrel
Created May 9, 2018 15:01
Show Gist options
  • Save Demandrel/5e09c00e918551197917bfdc7f53e67f to your computer and use it in GitHub Desktop.
Save Demandrel/5e09c00e918551197917bfdc7f53e67f to your computer and use it in GitHub Desktop.
Script Defi codeWar
def animalYears (firtYear, secondYear, afterThirdYear, animalYears)
HumanYears = 0
res = animalYears - firtYear
if res <= 0
HumanYears = 1
return HumanYears
res = res - secondYear
if res <= 0
HumanYears = 2
return HumanYears
while res > 0
res = res - afterThirdYear
HumanYears = HumanYears +1
return HumanYears
def owned_cat_and_dog(cat, dog)
ownedCat = animalYears(15, 9, 4, cat)
ownedDog = animalYears(15, 9, 5, dog)
return [ownedCat, ownedDog]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment