log python3 function ()
descrizione
log () restituisce il logaritmo naturale di x, x> 0.
grammatica
Quanto segue è il metodo log sintassi ():
import math math.log( x )
Nota: log () non è direttamente accessibile, abbiamo bisogno di importare il modulo per la matematica, richiamare il metodo attraverso oggetto statico.
parametri
- x - espressione numerica.
Valore di ritorno
Restituisce il logaritmo naturale di x, x> 0.Esempi
Quanto segue mostra un esempio di utilizzo del metodo log ():
#!/usr/bin/python3 import math # 导入 math 模块 print ("math.log(100.12) : ", math.log(100.12)) print ("math.log(100.72) : ", math.log(100.72)) print ("math.log(math.pi) : ", math.log(math.pi))
Dopo aver eseguito l'output sopra esempio è:
math.log(100.12) : 4.6063694665635735 math.log(100.72) : 4.612344389736092 math.log(math.pi) : 1.1447298858494002