In this assignment we write a simple TODO list program in Python. The user interface for out TODO list app will be a basic text parser. So for example if you want to add an item to your TODO list called clean my room, you would type: add todo clean my room.
Here's a summary of the commands understood by our parser:
add todo-item add an item to the TODO list.del todo-item removes an item from the TODO list. show shows items on the TODO listquit exits the program loop.One again, we will apply problem simplification and work on this problem in 3 parts.
add, del and show commands.Implement the provided algorithm as code.
Inputs: a command string
Outputs: print the command (if valid), or print "invalid command" or quit program
Algorithm (Steps in Program):
loop
input command
extract first word from command
if word equals "quit" exit loop
if word equals "add"
extract item from command
print "code to add item to todo list goes here"
else if word equals "del"
extract item from command
print "code to remove item from todo list goes here"
else if word equals "show"
print "code to show items on todo list goes here"
else if word equals "save"
print "code to save todo list to file goes here"
else
print "invalid command"
In [9]:
# Part 1: Step 2 Write code here
Next we will introduce the add, del and show functionality to the program. No longer will these commands print what they should do, they will actually get it done!
Here's what you need to change in your program:
todo"add" command to add the item to the todo list, and print a message saying the item was added."show" command to print each item the todo list using a for loop"del" command to remove item from the list, and print a message saying item was deleted.Here's an example of the working code:
Enter command: add go shopping
go shopping added.
Enter command: add chop wood
chop wood added.
Enter command: add eat pizza
eat pizza added.
Enter command: show
TODO list:
go shopping
chop wood
eat pizza
Enter command: del chop wood
chop wood deleted.
Enter command: show
TODO list:
go shopping
eat pizza
Enter command: quit
In [11]:
# Part 2: Step 2 Write code here
Reflect upon your experience completing this assignment. This should be a personal narrative, in your own voice, and cite specifics relevant to the activity as to help the grader understand how you arrived at the code you submitted. Things to consider touching upon: Elaborate on the process itself. Did your original problem analysis work as designed? How many iterations did you go through before you arrived at the solution? Where did you struggle along the way and how did you overcome it? What did you learn from completing the assignment? What do you need to work on to get better? What was most valuable and least valuable about this exercise? Do you have any suggestions for improvements?
To make a good reflection, you should journal your thoughts, questions and comments while you complete the exercise.
Keep your response to between 100 and 250 words.
--== Write Your Reflection Below Here ==--
In [ ]:
# RUN THIS CODE CELL TO TURN IN YOUR WORK!
from ist256.submission import Submission
Submission().submit()