77. Python Program to Remove a Task by Its Number
MediumAdd, remove
Overview
Remove an item by its position with pop(), and use the item you got back.
Problem Statement
A to-do list holds ["cook", "clean", "shop", "study"]. Read a task number (a whole number). Task 1 is cook. If the number is from 1 to the number of tasks, remove that task with pop() and print two lines: the task that is done, and the tasks that are left. Otherwise print No such task. For example, for 2:
Done: clean
Left: ['cook', 'shop', 'study']
Use input() with no prompt text: the tests type the input for you, and a prompt would end up in your output.
Input
One value per line, in this order. Example:
2
Output
The output for that example:
Done: clean
Left: ['cook', 'shop', 'study']
The tests try 5 different inputs.