Latest web development tutorials

fonction Python log10 ()

chiffres Python chiffres Python


description

log10 () retourne le logarithme en base 10 de x.


grammaire

Ce qui suit est la syntaxe de méthode log10 ():

import math

math.log10( x )

Note: log10 () ne sont pas directement accessibles, nous avons besoin d'importer le module de mathématiques, invoquer la méthode par objet statique.


Paramètres

  • x - expression numérique.

Valeur de retour

Retours logarithme en base 10 de x, x> 0.

Exemples

Le tableau suivant montre un exemple d'utilisation du procédé log10 ():

#!/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)

Après avoir exécuté l'exemple ci-dessus est sortie:

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

chiffres Python chiffres Python