Repository navigation
Expand file tree
/
Copy pathDaily Routine
More file actions
55 lines (44 loc) · 1.81 KB
/
Copy pathDaily Routine
File metadata and controls
55 lines (44 loc) · 1.81 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
from dataclasses import dataclass, field
from typing import List
@dataclass
class DailyRoutine:
routines: List[str] = field(default_factory=list)
def add_routine(self, routine: str) -> None:
"""Add a routine to the daily list."""
self.routines.append(routine)
print(f"✅ Routine '{routine}' added to your Daily Routine.")
def remove_routine(self, routine: str) -> None:
"""Remove a routine from the daily list if it exists."""
try:
self.routines.remove(routine)
print(f"🗑️ Routine '{routine}' removed from Daily Routine.")
except ValueError:
print(f"⚠️ Routine '{routine}' not found in Daily Routine.")
def display_routine(self) -> None:
"""Display all routines in an enumerated list."""
if self.routines:
print("\n📋 Your Daily Routine:")
for i, routine in enumerate(self.routines, start=1):
print(f"{i}. {routine}")
else:
print("\nHello Everyone!!")
print("No routines found in your Daily Routine.")
print("Add some routines to get started!")
def main():
daily_routine = DailyRoutine()
# Initial display
daily_routine.display_routine()
# Adding routines
daily_routine.add_routine("Do CSS Challenges")
daily_routine.add_routine("Make Python Projects")
daily_routine.add_routine("Attend Community Calls")
daily_routine.add_routine("Learn a thought every day")
# Display updated routines
daily_routine.display_routine()
# Removing routines
daily_routine.remove_routine("Assignments") # Routine not in list
daily_routine.remove_routine("College Time") # Routine not in list
# Final display
daily_routine.display_routine()
if __name__ == "__main__":
main()