如何使用python查找用户输入的自然日志?
import math
def log_e(power_of_e):
math.log = power_of_e
exponent = math.log
return exponent
my_number = float(input('Enter a number and I will give you it\'s natural logarithm:'))
print (log_e(my_number))
答案 0 :(得分:0)
import math
def log_e(power_of_e):
exponent=math.log(power_of_e)
return exponent
my_number=float(input('Enter a number and I will give you it\'s natural logarithm:'))
print (format(log_e(my_number),'.3f'))
答案 1 :(得分:0)
var ans = products.SelectMany(p => p.Variance.Select(v => new { p.name, v.Date, v.Value }))
.GroupBy(pv => pv.Date)
.Select(pvg => new { Date = pvg.Key, Fields = pvg.ToDictionary(p => p.name, p => p.Value) });
接受一个可选的第二个参数,它是要使用的基础。 math.log
是常量 e。将它们组合在一起,然后得到:
math.e