This file contains 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
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
import sprint_lib | |
class TailRecurseException: | |
def __init__(self, args, kwargs): | |
self.args = args | |
self.kwargs = kwargs | |
def tailcall(g): |
This file contains 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
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
import sys | |
import time | |
def add(x,y): | |
return x+y | |
def max(x,y): | |
if x<y: return y |
This file contains 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
class Cat: | |
def __init__(self, name): | |
self.name = name | |
self.mood = 50 | |
self.fullness = 50 | |
def sleep(self): | |
self.mood += 5 | |
self.fullness -= 10 |
This file contains 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
def recurrence_cocktail(ml): | |
if ml <= 2: | |
return 1, 1 | |
half_dose = ml // 2 | |
second_part_spirit, second_part_water = recurrence_cocktail(ml=half_dose) | |
return ml * .2 + second_part_spirit, ml * .3 + second_part_water | |
spirit, water = recurrence_cocktail(ml=1000) | |
spirit, water = map(int, (spirit, water)) | |
print(spirit, water, int(spirit/(spirit + water) * 100)) |