write a code to make a smart planner
Question
write a code to make a smart planner
🧐 Not the exact question you are looking for?Go ask a question
Solution
import datetime
class SmartPlanner:
def __init__(self):
self.tasks = []
def add_task(self, task_name, due_date):
task = {
'task_name': task_name,
'due_date': due_date,
'completed': False
}
self.tasks.append(task)
print(f"Task '{task_name}' added with due date {due_date}.")
def complete_task(self, task_name):
for task in self.tasks:
if task['task_name'] == task_name:
task['completed'] = True
print(f"Task '{task_name}' marked as completed.")
return
print(f"Task '{task_name}' not found.")
def remove_task(self, task_name):
for task in self.tasks:
if task['task_name'] == task_name:
self.tasks.remove(task)
print(f"Task '{task_name}' removed.")
return
print(f"Task '{task_name}' not found.")
def show_tasks(self):
if not self.tasks:
print("No tasks available.")
return
for task in self.tasks:
status = "Completed" if task['completed'] else "Pending"
print(f"Task: {task['task_name']}, Due Date: {task['due_date']}, Status: {status}")
# Example usage
planner = SmartPlanner()
planner.add_task("Finish project", datetime.date(2023, 10, 15))
planner.add_task("Buy groceries", datetime.date(2023, 10, 10))
planner.show_tasks()
planner.complete_task("Buy groceries")
planner.show_tasks()
planner.remove_task("Finish project")
planner.show_tasks()
Similar Questions
how to write a code in c language to make smart planner
smart planner using array,function,switch case,loop in c programming language
make a ppt on smart planner using array,loops,function,switch case
Context: make a ppt on smart planner using array,loops,function,switch case with an example and the whole ppt should be in english
I've found that keeping my school planner up to date and accurate is an ___________ practice. superfluous autonomous indispensable cravenSubmit Answer
1/2
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.