-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathToDo_list.py
More file actions
160 lines (128 loc) · 4.71 KB
/
Copy pathToDo_list.py
File metadata and controls
160 lines (128 loc) · 4.71 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
task_list = []
# Função criar tarefas
def new_tasks(name=str, description=str, category=str,priority=str, status=str):
name = input("Tarefa:\n")
description = input("Descrição:\n ")
category = input("Categoria:\n")
status = "Em andamento."
while True:
opcao = input("""
=-=-=-=-=-=PRIORIDADE=-=-=-=-=-=
1 - BAIXA
2 - MÉDIA
3 - ALTA
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
\nESCOLHA UMA OPÇÃO: """)
if opcao not in ["1", "2", "3"]:
print("Escolha uma opção válida!")
else:
match opcao:
case "1":
priority = "BAIXA"
break
case "2":
priority = "MÉDIA"
break
case "3":
priority = "ALTA"
break
new_task = {
"Tarefa": name,
"Descrição": description,
"Categoria": category,
"Prioridade": priority,
"Status":status
}
task_list.append(new_task)
# ================================================================================================
# Função que exibi todas as tarefas
def display_tasks():
if not task_list:
print("Lista está vazia!")
else:
for i, element in enumerate(task_list):
print(f"""
{i+1} - {element['Tarefa']}
Descrição: {element['Descrição']}
Categoria: {element['Categoria']}
Prioridade: {element['Prioridade']}
Status: {element['Status']}
""")
# ================================================================================================
# Função para concluir tarefa
def task_status():
indice = int(input("Digite o número da tarefa: ")) - 1
if 0 <= indice < len(task_list):
tarefa = task_list[indice]
tarefa["Status"] = "Concluído."
print(f"Tarefa '{tarefa['Tarefa']}' foi concluída com sucesso!")
else:
print("Tarefa não encontrada.")
# ================================================================================================
# Função para filtrar categoria
def filter_category():
category = input("Digite a categoria que deseja buscar: ")
result = []
for task in task_list:
if task["Categoria"].lower() == category.lower():
result.append(task)
if not result:
print("Nenhuma tarefa encontrada nessa categoria.")
else:
print("\nTarefas encontradas:\n")
for task in result:
print(f"Tarefa: {task['Tarefa']}")
print(f"Descrição: {task['Descrição']}")
print(f"Categoria: {task['Categoria']}")
print(f"Prioridade: {task['Prioridade']}")
print(f"Status: {task['Status']}")
print("-" * 30)
# ================================================================================================
# Função para filtrar Prioridade
def filter_priority():
priority = input("Digite a prioridade (BAIXA, MÉDIA, ALTA): ")
result = []
for task in task_list:
if task["Prioridade"].lower() == priority.lower():
result.append(task)
if not result:
print("Nenhuma tarefa encontrada com essa Prioridade.")
else:
print("\nTarefas encontradas:\n")
for task in result:
print(f"Tarefa: {task['Tarefa']}")
print(f"Descrição: {task['Descrição']}")
print(f"Categoria: {task['Categoria']}")
print(f"Prioridade: {task['Prioridade']}")
print(f"Status: {task['Status']}")
print("-" * 30)
# Funçào para exibir Menu
def display_menu():
print("\n1 - Adicinar tarefa")
print("2 - Listar tarefas")
print("3 - Filtrar Categoria")
print("4 - Filtrar Prioridade")
print("5 - Marca concluído")
# Função de encerrar o sistema
def main():
while True:
display_menu()
opcao = input("\nEscolha uma opção: ")
match opcao:
case "1":
# Adicinar nova tarefa
new_tasks()
case "2":
# Verificar tarefas
display_tasks()
case "3":
filter_category()
case "4":
filter_priority()
case "5":
task_status()
case "0":
print("Você escolheu a opção de sair.")
print("Saindo...")
break
main()