« Python : If, elif & else » : différence entre les versions

De www.yakakliker.org
(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 »)
 
Aucun résumé des modifications
Ligne 21 : Ligne 21 :
[[Catégorie:Python]]
[[Catégorie:Python]]
[[Catégorie:Scripts]]
[[Catégorie:Scripts]]
‎<html>
<script src='https://storage.ko-fi.com/cdn/scripts/overlay-widget.js'></script>
<script>
  kofiWidgetOverlay.draw('yakakliker', {
    'type': 'floating-chat',
    'floating-chat.donateButton.text': 'Café',
    'floating-chat.donateButton.background-color': '#00b9fe',
    'floating-chat.donateButton.text-color': '#fff'
  });
</script>
‎</html>

Version du 21 janvier 2025 à 14:30

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