Priorities and sorting (Todo App)

Add priority <id high|medium|low (<id priority <p; anything else: error: priority must be high, medium or low). New tasks are medium. list now sorts by priority (high, then medium, then low), then by id, and shows (high) or (low) after the checkbox (medium shows nothing): 2 [ ] (high) Write report.

Input: As before.

Output: As before.

Difficulty: Medium. Write your answer in the browser editor, run the examples, then submit it against hidden tests. Python and JavaScript are free; other languages are part of licode Club.

Hint

  • Map priorities to numbers (high 0, medium 1, low 2) and sort by (number, id).

More Todo App practice