Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- >>> class F:
- ... def __init__(self, cost, value):
- ... self.cost = cost
- ... self.value = value
- ... def getValueDividedByCost(self):
- ... return self.value / self.cost
- >>> superfood = F(0.1, 1000)
- >>> superfood.cost
- 0.1
- >>> superfood.value # so both of these are data attributes
- 1000
- >>> superfood.getValueDividedByCost() # this is calling a function (method)
- 10000.0
- >>>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement