When a task is no longer needed — whether it has been completed or simply cancelled — you can remove it permanently using option 4. Like the complete workflow, the application automatically displays your current task list before prompting for input, giving you the correct index at a glance. Once confirmed, the task is popped from the in-memory list and the updated list is written back toDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/FranksGP/Gestor_de_tareas/llms.txt
Use this file to discover all available pages before exploring further.
Tareas.json. The deletion is immediate and the remaining tasks are re-indexed on the next listing.
Workflow
Run the application
Open a terminal in the directory that contains The main menu is displayed:
index.py and start the program:Select option 4
At the prompt, type The application automatically calls
4 and press Enter:listarTask() and prints your current tasks before asking for input.Review the task list and enter the task number
The current task list is shown. Identify the number of the task you want to delete, then enter it and press Enter:
Full terminal example
The following example starts with two tasks and deletes the first one:What happens internally
When you enter a valid task number, the application callsdelete_task(index):
cargarTask()reads the current contents ofTareas.jsoninto a Python list.- The function checks that the provided
indexsatisfies0 < index <= len(tasks). If so, it callstasks.pop(index - 1), which removes the task object at that position and stores it indeleted_task. guardarTask(tasks)writes the remaining tasks back toTareas.json.- The confirmation message
Tarea '{deleted_task["titulo"]}' eliminada.is printed, displaying the title of the removed task.
Error handling
Option 4 handles two error conditions:-
Invalid index: If you enter a number that is less than
1or greater than the total number of tasks,delete_taskprints the following and makes no changes toTareas.json: -
Non-integer input: If you type something that is not a whole number (for example
abcor2.5), theValueErroris caught and the following message is printed instead: