lang:python:condition
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Prochaine révision | Révision précédente | ||
| lang:python:condition [2020/02/20 00:12] – Création avec "Condition classique" root | lang:python:condition [2025/11/10 09:37] (Version actuelle) – [switch] : utilisation de match / case root | ||
|---|---|---|---|
| Ligne 21: | Ligne 21: | ||
| </ | </ | ||
| + | ===Conditions multiples sur une même valeur=== | ||
| + | |||
| + | <code python> | ||
| + | if first in (' | ||
| + | print " | ||
| + | else: | ||
| + | print " | ||
| + | </ | ||
| + | |||
| + | ====switch==== | ||
| + | |||
| + | <code python> | ||
| + | animal = " | ||
| + | match animal: | ||
| + | case " | ||
| + | print(" | ||
| + | case " | ||
| + | print(" | ||
| + | case " | ||
| + | print(" | ||
| + | case _: | ||
| + | print(" | ||
| + | </ | ||
lang/python/condition.1582153930.txt.gz · Dernière modification : de root
