Assignment
Let's get started with the assignment. Let's add a timestamp to our Todo model.
A timestamp is a date and time when the todo was created.
We will use the datetime module to get the current date and time.
Also we need to adjust the print_todo function to tell users when there is no todo.
The requirements:
- Print a message when there is no todo, e.g.
You have nothing todo! - Add a timestamp when the user add a
todo - Add a timestamp when the user mark a
todoas done - Print the timestamp when printing a
todo - Print the done timestamp for done
todos
The expected format when printing the todos:
- [ ] {datetime} | {todo_item} | {done_datetime}
Example output:
- [ ] 2023-09-09 11:52:00 | Buy milk
- [ ] 2023-09-09 11:52:00 | Wash shoes
- [x] 2023-09-09 11:52:00 | Print assignment | 2023-09-09 13:52:00
Functions to modify are:
- add_todo
- mark_todo_done
- print_todo