Created
April 12, 2015 09:36
-
-
Save atmb4u/9d5dd4f943a5659f166f to your computer and use it in GitHub Desktop.
Function Pipelines with persistent State (FPS) - FPS programming
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
class WineBottle(object): | |
def __init__(self): | |
self.wine = 100 | |
self.max_capacity = 500 | |
self.make = "Plastic" | |
def add_wine(self, amount): | |
if self.max_capacity < self.wine + amount: | |
self.wine = self.max_capacity | |
print "OverFlow" | |
else: | |
self.wine += amount | |
print self.wine | |
def drink_wine(self, amount): | |
if amount > self.wine: | |
self.wine = 0 | |
print "Finish" | |
else: | |
self.wine -= amount | |
print self.wine |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment