python:bases:fonction

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentes Révision précédente
Prochaine révision
Révision précédente
Dernière révisionLes deux révisions suivantes
python:bases:fonction [2022/09/03 10:21] – [2.1 Paramètres par défaut (optionnels)] philpython:bases:fonction [2024/02/29 08:39] – [Python - Les fonctions] phil
Ligne 3: Ligne 3:
 ===== Python - Les fonctions ===== ===== Python - Les fonctions =====
  
-[Mise à jour le : 14/6/2022]+[Mise à jour le : 29/2/2024]
  
   * **Sources**    * **Sources** 
Ligne 10: Ligne 10:
  
   * **Ressources**    * **Ressources** 
 +    * <html><a href="https://www.pythonmorsels.com/built-in-functions-in-python/" target="_blank">Fonctions intégrées Python à connaître</a></html>
     * **Real Python** : <html><a href="https://realpython.com/python-main-function/" target="_blank">Defining Main Functions in Python</a></html>     * **Real Python** : <html><a href="https://realpython.com/python-main-function/" target="_blank">Defining Main Functions in Python</a></html>
  
Ligne 39: Ligne 40:
  
 === 1.1 Forme simple de la déclaration et de l'appel (ordonnée)=== === 1.1 Forme simple de la déclaration et de l'appel (ordonnée)===
-> Dans cette forme, les arguments sont dits:"positionnels" car leur position lors de l'appel doit correspondre à la position des paramètres dans l'en-tête de la fonction.+<callout type="info" icon="true">Dans cette forme, les arguments sont dits:"**positionnels**" car leur position lors de l'appel doit correspondre à la position des paramètres dans l'en-tête de la fonction.</callout>
  
 <code python *.py> <code python *.py>
Ligne 297: Ligne 298:
 </code> </code>
  
-<note important>Un module **<nowiki>__name__</nowiki>** est égal à '**<nowiki>__main__</nowiki>**' lorsqu'il est lu à partir d'une entrée standard, d'un script ou d'une invite interactive.</note>+<callout type="warning" icon="true">Un module **<nowiki>__name__</nowiki>** est égal à '**<nowiki>__main__</nowiki>**' lorsqu'il est lu à partir d'une entrée standard, d'un script ou d'une invite interactive.</callout>
  
   * **//Bonnes pratiques//**   * **//Bonnes pratiques//**
Ligne 354: Ligne 355:
   * <html><a href="https://realpython.com/python-lambda/" target="_blank">How to Use Python Lambda Functions</a></html>   * <html><a href="https://realpython.com/python-lambda/" target="_blank">How to Use Python Lambda Functions</a></html>
   * <html><a href="https://realpython.com/run-python-scripts/" target="_blank">How to Run Your Python Scripts</a></html>   * <html><a href="https://realpython.com/run-python-scripts/" target="_blank">How to Run Your Python Scripts</a></html>
 +  * <html><a href="https://realpython.com/python-sum-function/" target="_blank">Python's sum(): The Pythonic Way to Sum Values</a></html>
 +  * <html><a href="https://realpython.com/len-python-function/" target="_blank">Using the len() Function in Python</a></html>
 +  * <html><a href="https://realpython.com/python-min-and-max/" target="_blank">Python's min() and max(): Find Smallest and Largest Values</a></html>
 +  * <html><a href="https://realpython.com/python-range/" target="_blank">The Python range() Function (Guide)</a></html>
  
 ---- ----
  • python/bases/fonction.txt
  • Dernière modification : 2024/02/29 08:40
  • de phil