Latest web development tutorials

Python log10 () Funktion

Python Zahlen Python Zahlen


Beschreibung

log10 () -Methode gibt den Logarithmus zur Basis 10 x.


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/python
import math   # 导入 math 模块

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

Nach dem obigen Beispiel Ausgang läuft:

math.log10(100.12) :  2.00052084094
math.log10(100.72) :  2.0031157171
math.log10(119L) :  2.07554696139
math.log10(math.pi) :  0.497149872694

Python Zahlen Python Zahlen