-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtask.py
More file actions
33 lines (25 loc) · 798 Bytes
/
Copy pathtask.py
File metadata and controls
33 lines (25 loc) · 798 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from datetime import date
class Task:
def __init__(self, title: str, description: str, due_date: date):
"""
Initializes a new task with a title, description, and due date.
"""
self.title = title
self.description = description
self.due_date = due_date
self.completed = False
def mark_completed(self):
"""
Marks the task as completed.
"""
self.completed = True
def __str__(self):
"""
Returns a string representation of the task.
"""
status_string = ""
if self.completed:
status_string = "Completed"
else:
status_string = "In Progress"
return f"{self.title}\n{self.description}\n{self.due_date}\n{status_string}"