Python3 Fonction log10()
Description
La méthode log10() renvoie le logarithme en base 10 de x, où x>0.
Syntaxe
Voici la syntaxe de la méthode log10() :
import math math.log10( x )
Remarque :log10() n'est pas directement accessible ; vous devez importer le module math et invoquer cette méthode via l'objet statique.
Parameters
- x -- expression numérique.
Valeur de retour
Renvoie le logarithme en base 10 de x, où x>0.Exemples
L'exemple suivant montre l'utilisation de la méthode 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))
La sortie de l'exemple ci-dessus après exécution est :
math.log10(100.12) : 2.0005208409361854 math.log10(100.72) : 2.003115717099806 math.log10(119) : 2.075546961392531 math.log10(math.pi) : 0.4971498726941338Autres extensions
Nombres en Python3