Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/list/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
String 计算不带字符串或列表的用户输入的对数_String_List_Input_Logarithm - Fatal编程技术网

String 计算不带字符串或列表的用户输入的对数

String 计算不带字符串或列表的用户输入的对数,string,list,input,logarithm,String,List,Input,Logarithm,我想计算用户输入的log2。但我不能在日志中使用字符串或列表,只能使用实数。如何让用户输入math.log参数而不必手动输入? 最初我打算把它指定为术语freq.No Go freq = input('what frequency do you want to convert to HSB? ') import math logged = math.log(freq, 2) fint = int(logged) ffloa = logged - fint hue = int((ffloa*3

我想计算用户输入的log2。但我不能在日志中使用字符串或列表,只能使用实数。如何让用户输入math.log参数而不必手动输入? 最初我打算把它指定为术语freq.No Go

freq = input('what frequency do you want to convert to HSB?  ')
import math

logged = math.log(freq, 2)
fint = int(logged)
ffloa = logged - fint
hue = int((ffloa*360)-11)
bri = fint*7
sat = 128 - bri

您是否在询问如何将用户输入转换为数字类型?试试
freq=float(输入('您想转换成HSB的频率是多少?)
!非常感谢!