-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDailyManagementTool.py
More file actions
66 lines (57 loc) · 1.69 KB
/
DailyManagementTool.py
File metadata and controls
66 lines (57 loc) · 1.69 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import datetime
# This tool allows users to enter and manage daily tasks.
class Task:
def __init__(self, name, deadline):
self.name = name
self.deadline = deadline
self.completed = False
def complete(self):
self.completed = True
def __str__(self):
return f"{self.name} ({self.deadline}) - {'Completed' if self.completed else 'Incomplete'}"
def add_task(tasks):
name = input("Enter task name: ")
deadline = input("Enter task deadline (DD/MM/YYYY): ")
deadline = datetime.datetime.strptime(deadline, "%d/%m/%Y")
task = Task(name, deadline)
tasks.append(task)
print("Task added successfully.")
def show_tasks(tasks):
if not tasks:
print("No tasks found.")
return
for task in tasks:
print(task)
def complete_task(tasks):
if not tasks:
print("No tasks found.")
return
name = input("Enter the name of the task to complete: ")
for task in tasks:
if task.name == name:
task.complete()
print("Task marked as completed.")
return
print("Task not found.")
def main():
tasks = []
while True:
print("Daily Management System")
print("1. Add task")
print("2. Show tasks")
print("3. Complete task")
print("4. Quit")
choice = input("Enter your choice (1-4): ")
if choice == "1":
add_task(tasks)
elif choice == "2":
show_tasks(tasks)
elif choice == "3":
complete_task(tasks)
elif choice == "4":
print("Goodbye!")
break
else:
print("Invalid choice.")
if __name__ == "__main__":
main()