Essentiel
contact = {"nom": "Léa", "ville": "Lyon", "age": 34}
contact["nom"] # "Léa"
contact.get("tel", "inconnu") # pas d'erreur si absente
contact["tel"] = "06…" # ajouter / modifier
del contact["ville"] # supprimer
"nom" in contact # True
contact.keys(), contact.values(), contact.items()
Compter
compte = {}
for mot in texte.split():
compte[mot] = compte.get(mot, 0) + 1
# ou : from collections import Counter ; Counter(texte.split())Les dictionnaires correspondent au format JSON. Suite : les fonctions.