Python : If, elif & else

De www.yakakliker.org
Révision datée du 25 mars 2024 à 12:45 par Administrateur (discussion | contributions) (Page créée avec « === Exemple : === <syntaxhighlight lang="python3"> a = 10 if a > 50: print('Supérieur à 50') elif a > 20: print('Supérieur à 20') elif a > 5: print('Supérieur à 5') # Cette instruction sera exécutée else: print('Inférieur à 5') </syntaxhighlight> === Liens === https://dyma.fr/developer/list/chapters/core/61969e0166ef0d5e68f7f647/lesson/python/619801296638f0c94cbbe6c0/3/2 Catégorie:Python Catégorie:Scripts »)
(diff) ← Version précédente | Voir la version actuelle (diff) | Version suivante → (diff)

Exemple :

a = 10
if a > 50:
    print('Supérieur à 50')
elif a > 20:
    print('Supérieur à 20')
elif a > 5:
    print('Supérieur à 5')  # Cette instruction sera exécutée
else:
    print('Inférieur à 5')

Liens

https://dyma.fr/developer/list/chapters/core/61969e0166ef0d5e68f7f647/lesson/python/619801296638f0c94cbbe6c0/3/2