Reading about Python? Actually practice it. Try PyChallenge free

Python Tutorial

Mathematische Operationen

Python hosting: PythonAnywhere: host, run and code Python in the cloud. Free tier available.

Tipp Sie können den Python-Interpreter als Taschenrechner verwenden. Dazu starten Sie einfach Python ohne IDE und Dateinamen. Beispiel:
  Python 2.7.6 (Standard, 22. Juni 2015, 17:58:13) 
[GCC 4.8.2] auf linux2
Geben Sie "help", "copyright", "Credits" oder "Lizenz" für weitere Informationen.
>>> 18 * 17
306
>>> 2 ** 4
16
>>> 
  

Mathematische Funktionen

Python unterstützt eine Vielzahl von mathematischen Funktionen.

Practice
Stop reading. Start writing Python.
PyChallenge gives you interactive exercises in your browser, no install needed.
Practice Python with interactive exercises
Funktion Gibt Beispiel
Abs(x) Der Absolute Wert von x zurückgibt.

X =-35
X = abs(x)
Print(x)
CMP(x,y) Gibt-1 zurück, wenn X < y
Gibt 0 zurück, wenn x gleich y
Gibt 1 zurück, wenn X > y.
X = 6
y = 4
Drucken (cmp(x,y))
EXP(x) Kehrt die exponentielle x

Import-Mathematik
X = 6
Drucken (math.exp(x))
Log(x) Den natürlichen Logarithmus von x

Import-Mathematik
X = 6
Drucken (math.log(x))
log10(x) Der Logarithmus Base-10 x

Import-Mathematik
X = 6
Drucken (math.log10(x))
Pow(x,y) Das Ergebnis von X ** y
Import-Mathematik
X = 6
Drucken (math.pow(x,2))
sqrt(x) Die Quadratwurzel von x
Import-Mathematik
X = 6
Drucken (math.sqrt(x))