Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. # define the Vehicle class
  2. class Vehicle():
  3.  
  4. def __init__(self, name, kind, color, value):
  5.  
  6. self.name = name
  7. self.kind = kind
  8. self.color = color
  9. self.value = value
  10.  
  11. def description(self):
  12. desc_str = "%s is a %s %s worth $%.2f." % (self.name, self.color, self.kind, self.value)
  13. return desc_str
  14.  
  15. # your code goes here
  16. car1 = Vehicle("Fer", "convertible", "red", 60000.00)
  17. car2 = Vehicle("Jump", "van", "blue", 10000.00)
  18.  
  19. #car1.name = "Fer"
  20. #car1.kind = "convertible"
  21. #car1.color = "red"
  22. #car1.value = 60000.00
  23.  
  24. #car2.name = "Jump"
  25. #car2.kind = "van"
  26. #car2.color = "blue"
  27. #car2.value = 10000.00
  28.  
  29. # test code
  30. print(car1.description())
  31. print(car2.description())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement