I am making a To-do app and the priority,status,time left to finish and the name is saved in a CSV file.When the status is updated the the CSV file status should also be updated this is the code when the CSV file is not getting updated:
def mark_task():
global freetime
print("You selected Option 5.")
#Counting the tasks
count2 = 0
for i, row in enumerate(mytask):
count2 += 1
print(count2,".",row['task_name'],".status: ",row['status'])
task_nam = input("Select the task you want to update: ")
status = input("Enter status(Pending/Completed): ")
#marking tasks
for i, row in enumerate(mytask):
if row['task_name'] == task_nam:
row['status'] = status
print(f'Status {status} updated for the task {row['task_name']}')
freetime += 1
break
elif row['task_name'] != task_nam:
print(f"Record Not found in the dictionary {task_nam}")
break
so I want it to update in the CSV file when the task gets updated in the code