Latest web development tutorials

fonction python3 log10 ()

python3 numérique python3 numérique


description

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


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

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

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

python3 numérique python3 numérique