Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class car:
- def __init__(self, eff):
- # @param eff: int; efficienza dell'automobile
- self.eff = eff
- self.carb = 0
- def drive (self, dist):
- # @param dist: int; distanza percorsa dall'automobile
- usedCarb = float(dist) / self.eff
- remCarb = self.carb - usedCarb
- if remCarb < 0:
- self.carb = 0
- print 'Hai finito il carburante, passa al prossimo distributore!'
- else:
- self.carb = remCarb
- print 'Meta! :)'
- def get_carb(self):
- return self.carb
- def add_carb(self, add):
- # @param add: int; carburante da aggiungere
- self.carb = self.carb + add
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement