Keywords
Python ↔ Baobab
22 correspondences
Every Python keyword has a direct French equivalent. Same indentation, same semantics: only the language changes.
| Python | Baobab | Description |
|---|---|---|
| if / elif / else | si / sinonsi / sinon | Conditional branching. |
| for x in … | pour x dans … | Loop over an iterable. |
| while | tantque | Conditional loop. |
| def | fonction | Function definition. |
| return | retourner | Return a value from a function. |
| class | classe | Class definition. |
| break | casser | Exit the loop immediately. |
| continue | continuer | Skip to the next iteration. |
| pass | passer | Empty statement (does nothing). |
| try / except / finally | essayer / attraper / enfin | Exception handling. |
| raise | lever | Raise an exception. |
| with … as … | avec … comme … | Context manager (files, resources). |
| import / from | importer / depuis | Module imports. |
| True / False / None | vrai / faux / nul | Boolean literals and null value. |
| and / or / not | et / ou / non | Logical operators. |
| in / not in | dans / non dans | Membership test. |
| is | est | Identity test (same object). |
| del | supprimer | Delete a variable or item. |
| lambda | lambda | One-line anonymous function. |
| global | global | Declare a global variable inside a function. |
| assert | affirmer | Check a condition is true, otherwise raise an error. |
| yield | produire | Yield a value from a generator. |
Complete example — Baobab ↔ Python
Baobab
123456789101112131415# Panorama des mots-clés
pour n dans intervalle(10):
si n == 3:
continuer # saute 3
sinonsi n == 7:
casser # arrête à 7
sinon:
afficher(n) # → 0 1 2 4 5 6
essayer:
supprimer inconnu
attraper Erreur comme e:
afficher("Attrapé !")
enfin:
afficher("Toujours exécuté")Python
123456789101112131415# Keyword overview
for n in range(10):
if n == 3:
continue # skips 3
elif n == 7:
break # stops at 7
else:
print(n) # → 0 1 2 4 5 6
try:
del inconnu
except Exception as e:
print("Attrapé !")
finally:
print("Toujours exécuté")