Python3 log10()-Funktion

Python3 数字Python3 Zahlen


Beschreibung

Die Methode log10() gibt den Logarithmus zur Basis 10 von x zurück, wobei x>0.


Syntax

Die folgende Syntax gilt für die Methode log10():

import math

math.log10( x )

Hinweis:log10() ist nicht direkt zugänglich; Sie müssen das math-Modul importieren und diese Methode über das statische Objekt aufrufen.


Parameters

  • x -- numerischer Ausdruck.

Rückgabewert

Gibt den Logarithmus zur Basis 10 von x zurück, wobei x>0.

Beispiele

Das folgende Beispiel demonstriert die Verwendung der Methode log10():

#!/usr/bin/python3
import math   # 导入 math 模块

print ("math.log10(100.12) : ", math.log10(100.12))
print ("math.log10(100.72) : ", math.log10(100.72))
print ("math.log10(119) : ", math.log10(119))
print ("math.log10(math.pi) : ", math.log10(math.pi))

Die Ausgabe des obigen Beispiels nach der Ausführung ist:

math.log10(100.12) :  2.0005208409361854
math.log10(100.72) :  2.003115717099806
math.log10(119) :  2.075546961392531
math.log10(math.pi) :  0.4971498726941338

Python3 数字Python3 Zahlen

Andere Erweiterungen