Skip to content

Commit

Permalink
Create TaskPlanner.py
Browse files Browse the repository at this point in the history
  • Loading branch information
sachinrafic committed Apr 20, 2024
1 parent 640e79f commit cbda082
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions TaskPlanner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import datetime
import csv

def load_tasks(filename='tasks.csv'):
tasks = []
with open(filename, 'r', newline='') as file:
reader = csv.reader(file)
for row in reader:
tasks.append({'task': row[0], 'deadline': row[1], 'completed': row[2]})
return tasks

def save_tasks(tasks, filename='tasks.csv'):
with open(filename, 'w', newline='') as file:
writer = csv.writer(file)
for task in tasks:
writer.writerow([task['task'], task['deadline'], task['completed']])

def add_task(task, deadline):
tasks = load_tasks()
tasks.append({'task': task, 'deadline': deadline, 'completed': 'No'})
save_tasks(tasks)
print("Task added successfully!")

def show_tasks():
tasks = load_tasks()
for task in tasks:
print(f"Task: {task['task']}, Deadline: {task['deadline']}, Completed: {task['completed']}")

# Example usage
add_task('Write daily report', '2024-04-20')
show_tasks()

0 comments on commit cbda082

Please sign in to comment.