Python math.pi-Konstante

Python math 模块Python math-Modul

Python math.piGibt einen Gleitkommawert π zurück, der sich im Allgemeinen auf Pi bezieht, die Kreiszahl PI (3.1415...).

PI: 3.141592653589793.

Syntax

Die Syntax der Konstante math.pi lautet:

math.pi

Rückgabewert

Gibt einen Float 3.141592653589793 zurück, der Pi darstellt.

Beispiel

Das folgende Beispiel gibt PI zurück:

Beispiel

# Importiere das math-Paket
import math

# Ausgabe PI
print (math.pi)

Ausgabeergebnis:

3.141592653589793

Python math 模块Python math-Modul

Andere Erweiterungen