import datetime
# Define a class to represent a task
class Task:
def __init__(self, description, deadline):
[Link] = description
[Link] = deadline
[Link] = False
def mark_completed(self):
[Link] = True
# Define a class to represent a daily goal
class DailyGoal:
def __init__(self, date):
[Link] = date
[Link] = []
def add_task(self, task):
[Link](task)
def list_tasks(self):
for idx, task in enumerate([Link]):
status = "Done" if [Link] else "Pending"
print(f"{idx + 1}. {[Link]} - {[Link]('%H:
%M')} - {status}")
def mark_task_completed(self, task_index):
if 0 <= task_index < len([Link]):
[Link][task_index].mark_completed()
# Function to create a new daily goal
def create_daily_goal():
today = [Link]()
goal = DailyGoal(today)
return goal
# Function to add a new task to a goal
def add_task_to_goal(goal):
description = input("Enter task description: ")
deadline_str = input("Enter task deadline (HH:MM): ")
deadline = [Link](deadline_str, "%H:%M").time()
task = Task(description, deadline)
goal.add_task(task)
# Function to mark a task as completed
def complete_task(goal):
goal.list_tasks()
task_index = int(input("Enter the number of the task you completed: ")) - 1
goal.mark_task_completed(task_index)
# Main function to drive the program
def main():
goal = create_daily_goal()
while True:
print("\n1. Add a task")
print("2. View tasks")
print("3. Complete a task")
print("4. Exit")
choice = input("Choose an option: ")
if choice == "1":
add_task_to_goal(goal)
elif choice == "2":
goal.list_tasks()
elif choice == "3":
complete_task(goal)
elif choice == "4":
break
else:
print("Invalid choice. Please try again.")
if __name__ == "__main__":
main()