Advertisement
Guest User

Untitled

a guest
Oct 25th, 2016
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.60 KB | None | 0 0
  1. class Car(object):
  2.     condition = "new"
  3.     def __init__(self, model, color, mpg):
  4.         self.model = model
  5.         self.color = color
  6.         self.mpg   = mpg
  7.     def display_car(self):
  8.         print "This is a %s %s with %s MPG." % (self.color, self.model, str(self.mpg))
  9.     def drive_car(self):
  10.         self.condition = "used"
  11.  
  12. class ElectricCar(Car):
  13.     def __init__(self, model, color, mpg, battery_type):
  14.         self.model = model
  15.         self.color = color
  16.         self.mpg   = mpg
  17.         battery_type = battery_type
  18.  
  19. my_car = ElectricCar("DeLorean", "silver", 88, "molten salt")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement