-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
27 lines (25 loc) · 875 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
todos = []
while True:
user_action = input("type add, edit, complete, show or exit: ")
user_action = user_action.strip()
match user_action:
case 'add':
todo = input("enter a todo: ")
todos.append(todo)
case 'show' | 'display':
for index, item in enumerate(todos):
row = f"{index + 1}-{item}"
print(row)
case 'edit':
number = int(input('which task number do you want to edit?: '))
number = number - 1
new_todo = input('enter new todo: ')
todos[number] = new_todo
case 'complete':
number = int(input('which task number do you want to complete?: '))
todos.pop(number - 1)
case 'exit':
break
case _:
print("you entered an unknown command")
print("bye")