Python3 log10 () Funktion
Beschreibung
log10 () -Methode gibt den Logarithmus zur Basis 10 x, x> 0.
Grammatik
Im Folgenden ist die Syntax log10 () -Methode:
import math math.log10( x )
Hinweis: log10 () nicht direkt zugänglich sind, müssen wir Mathematikmodul zu importieren, rufen Sie die Methode durch statisches Objekt.
Parameter
- x - numerischer Ausdruck.
Rückgabewert
Returns Basis 10 Logarithmus von x, x> 0.Beispiele
Nachfolgend ein Beispiel für die Verwendung log10 () Methode:
#!/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))
Nach dem obigen Beispiel Ausgang läuft:
math.log10(100.12) : 2.0005208409361854 math.log10(100.72) : 2.003115717099806 math.log10(119) : 2.075546961392531 math.log10(math.pi) : 0.4971498726941338