I'm working on a todo list in Python and I am currently stuck on printing the todo list.
I have my add code and view code as such:
if sel == '1': #add task
name = input("enter task name: ")
prio = input("enter priority level (High | Medium | Low): ")
add(todo, name, prio)
view(task)
elif sel == '3': #print todo list
view2(task)
exit
and these are the functions im using:
def add(todo, x, y):
todo[x] = y
def view(x):
x.append(dict(todo))
def view2(x):
print(x)
I'm able to add items to a dictionary print the dictionary the first time i select the option to print list. The second time i print it gives the below output
[{'test 1': 'low'}, {'test 1': 'low', 'test 2 ': 'low'}]
my ultimate goal is to get an output as shown below, but i can't get passed this first wall. Any advice? also, would i need to print a nested dictionary to get a numbered list?
1 - test 1 - low
2 - test 2 - low
Thanks in advance !