-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchallenge1.py
More file actions
36 lines (32 loc) · 1.03 KB
/
challenge1.py
File metadata and controls
36 lines (32 loc) · 1.03 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
#empty list
task_list = []
#Ajouter
def add_task(task_list, nom, level):
task = {"Tâche": nom, "Intensité": level}
task_list.append(task)
#Supprimer
def remove_task(task_list, nom):
for task in task_list:
if task["Tâche"] == nom:
task_list.remove(task)
break
#Afficher
def display_task(task_list):
for task in task_list:
print(f"Tâche: {task['Tâche']}, Intensité: {task['Intensité']}")
# Action
while True:
action = input("Que voulez-vous faire ? (ajouter/supprimer/afficher/quitter) : ")
if action == "ajouter":
nom = input("Entrez le nom de la tâche : ")
level = input("Entrez l'intensité de la tâche: ")
add_task(task_list, nom, level)
elif action == "supprimer":
nom = input("Entrez le nom de la tâche à supprimer : ")
remove_task(task_list, nom)
elif action == "afficher":
display_task(task_list)
elif action == "quitter":
break
else:
print("Action non reconnue. Veuillez réessayer.")