-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsame_project_with_dict.py
58 lines (43 loc) · 1.14 KB
/
same_project_with_dict.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
58
work_list = [] #create empty list
#function to add task
def add_task(task):
work_list.append({"Work": task , "Completed":False})
#function to update task
def update(index,new_task):
if index < len(work_list):
work_list[index]["Work"]=new_task
#function to remove task
def remove(index):
if index < len(work_list):
work_list.pop(index)
#function to mark task as complete
def complete(index):
if index < len(work_list):
work_list[index]["Completed"]=True
#function to mark task as incomplete
def incomplete(index):
if index < len(work_list):
work_list[index]["Completed"]=False
#function to display task
def display():
for i, task in enumerate(work_list):
checkbox = '☑' if task['Completed'] else '☐'
print(f"{checkbox} {task['Work']}")
add_task("learn python")
add_task("learn java")
add_task("join tags")
print("Before update")
display()
update(0,"Learn python & Django")
print("After update")
display()
remove(1)
print("After remove")
display()
complete(0)
print("After completed task 1")
display()
complete(1)
complete(2)
print("After completed all task")
display()