python:fonctions

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
python:fonctions [2019/10/20 15:53] physixpython:fonctions [2020/07/24 03:31] (Version actuelle) – modification externe 127.0.0.1
Ligne 3: Ligne 3:
 ===== Créer une fonction ===== ===== Créer une fonction =====
  
-<code>+<code python>
 def parabole(x): def parabole(x):
     return x ** 2 - 3     return x ** 2 - 3
Ligne 13: Ligne 13:
 Pour l'utiliser, il suffit de taper parabole et un argument entre parenthèses. Cet argument sera affecté à la variable x de la définition de la fonction. Cette fonction renverra alors le résultat. Pour l'utiliser, il suffit de taper parabole et un argument entre parenthèses. Cet argument sera affecté à la variable x de la définition de la fonction. Cette fonction renverra alors le résultat.
  
-<code>+<code python>
 parabole(4) parabole(4)
  
Ligne 20: Ligne 20:
 ===== Importer une fonction ===== ===== Importer une fonction =====
  
-<code>+<code python>
 from math import cos, pi from math import cos, pi
  
Ligne 31: Ligne 31:
 donne donne
  
-<code>+<code python>
 3.141592653589793 3.141592653589793
  
Ligne 40: Ligne 40:
 ---- ----
  
-<code>+<code python>
 import math import math
  
Ligne 54: Ligne 54:
 </code> </code>
  
----- 
  
-<code>+ 
 +<code python>
 import math as m import math as m
  
  • python/fonctions.1571579591.txt.gz
  • Dernière modification : 2020/07/24 00:23
  • (modification externe)