« Python : Operators » : différence entre les versions
De www.yakakliker.org
Aucun résumé des modifications |
Aucun résumé des modifications |
||
(2 versions intermédiaires par le même utilisateur non affichées) | |||
Ligne 1 : | Ligne 1 : | ||
=== Opérateurs d'affectation === | |||
<syntaxhighlight lang="python3"> | |||
a = 42 | |||
print(a) | |||
</syntaxhighlight><syntaxhighlight lang="python3"> | |||
a = 1 | |||
a += 2 | |||
print(a) # 3 | |||
</syntaxhighlight> | |||
=== Opérateurs arithmétiques "Arithmetic Operators" === | === Opérateurs arithmétiques "Arithmetic Operators" === | ||
[[Fichier:Capture d’écran du 2024-03-22 15-58-01.png|sans_cadre|591x591px]] | [[Fichier:Capture d’écran du 2024-03-22 15-58-01.png|sans_cadre|591x591px]]<syntaxhighlight lang="python3"> | ||
print(2 + 3) # Addition => 5 | |||
print(12 - 3) # Soustraction => 9 | |||
print(5 * 3) # Multiplication => 15 | |||
print(12 / 3 ) # Division => 4.0 | |||
print(22 % 6 ) # Modulo => 4 (reste de la division) | |||
print(22 // 6 ) # Division entière => 3 | |||
print(2 ** 3 ) # 8 | |||
</syntaxhighlight> | |||
=== Opérateurs d'assignation "Assignment Operators" === | === Opérateurs d'assignation "Assignment Operators" === | ||
Ligne 6 : | Ligne 24 : | ||
=== Opérateurs de comparaison "Comparison Operators" === | === Opérateurs de comparaison "Comparison Operators" === | ||
[[Fichier:Capture d’écran du 2024-03-22 16-03-35.png|sans_cadre|591x591px]] | [[Fichier:Capture d’écran du 2024-03-22 16-03-35.png|sans_cadre|591x591px]]<syntaxhighlight lang="python3"> | ||
a = 2 | |||
b = 3 | |||
print(a < b) # True | |||
</syntaxhighlight> | |||
=== Opérateurs logiques "Logical Operators" === | === Opérateurs logiques "Logical Operators" === | ||
Ligne 26 : | Ligne 48 : | ||
[[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> | |||
<html> | |||
<a href="https://www.compteurdevisite.com" title="compteur web gratuit sans pub"><img src="https://counter6.optistats.ovh/private/compteurdevisite.php?c=b4epghealnwlf7wuq7gn3ygll9aywrfx" border="0" title="compteur web gratuit sans pub" alt="compteur web gratuit sans pub"></a> | |||
</html> |
Dernière version du 17 février 2025 à 18:21
Opérateurs d'affectation
a = 42
print(a)
a = 1
a += 2
print(a) # 3
Opérateurs arithmétiques "Arithmetic Operators"
print(2 + 3) # Addition => 5
print(12 - 3) # Soustraction => 9
print(5 * 3) # Multiplication => 15
print(12 / 3 ) # Division => 4.0
print(22 % 6 ) # Modulo => 4 (reste de la division)
print(22 // 6 ) # Division entière => 3
print(2 ** 3 ) # 8
Opérateurs d'assignation "Assignment Operators"
Opérateurs de comparaison "Comparison Operators"
a = 2
b = 3
print(a < b) # True