Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import datetime
- class car():
- def __init__(self, color,make,model,year,maintanenance_freq):
- self.color=color
- self.make=make
- self.model=model
- self.year=year
- self.maintanenance_freq=maintanenance_freq
- def vehicle_age(self):
- now = datetime.datetime.now()
- return(now.year-self.year)
- @classmethod
- def maintenance_window_cls(cls,window):
- cls.maintanenance_freq = window
- return cls.maintanenance_freq
- car1= car("Green","Honda","Accord",2014,12)
- car2= car("White","Lexus","NX",2017,12)
- car.maintenance_window_cls(6)
- print(car2.maintanenance_freq)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement