我有两个不同的速率,用户可以为他的老师,我想转换每个速率的总和,以像素,以便我可以有进度条效应,例如:
maximum_pixels = 100 #maximum width
services = 4.5 #width: 95px
professionalism = 5.0 #width: 100px
total_percentage = maximum_pixels * services / maximum_pixels我如何在代码中实现这一点?
发布于 2017-10-19 14:04:03
maxAllowed = 100
minAllowed = 0
unscaledNum = 3
_min = 0
_max = 5
((maxAllowed - minAllowed) * (unscaledNum - _min) / (_max - _min) + minAllowed)结果:
60.0https://stackoverflow.com/questions/46831729
复制相似问题