-
Notifications
You must be signed in to change notification settings - Fork 0
/
list.py
57 lines (45 loc) · 1.14 KB
/
list.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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
data = []
def print_definition():
print("TASK MANAGEMENT SYSTEM")
print("1 - Add Task")
print("2 - Edit Task")
print("3 - View all Tasks")
print("4 - Delete a task")
print("5 - Exit")
def show():
print("Tasks are: ")
for iteration, item in enumerate(data):
print(f"{iteration + 1} . {item}")
print("")
def store():
data_input = input("Enter task: ")
data.append(data_input)
print("Task has been added")
print("")
def edit():
id_input = int(input("Specify the number of task: "))
index = id_input - 1
data.pop(index)
data_input = input("Enter new task name: ")
data.insert(index, data_input)
print("Task has been updated")
print("")
def delete():
id_input = int(input("Specify the number of task: "))
index = id_input - 1
data.pop(index)
print("Task has been deleted")
print("")
while True:
print_definition()
choice = input("Enter your choice:")
if choice == '1':
store()
elif choice == '2':
edit()
elif choice == '3':
show()
elif choice == '4':
delete()
elif choice == '5':
break