Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update car.py #114

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions car.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
from abc import ABC, abstractmethod

from datetime import datetime

class Car(ABC):
def __init__(self, last_service_date):
self.last_service_date = last_service_date

@abstractmethod
def needs_service(self):
pass
current_date = datetime.now()
# Check if the car needs service based on some logic
# For example, we'll assume it needs service if more than 365 days have passed since the last service
days_since_last_service = (current_date - self.last_service_date).days
return days_since_last_service > 365