4个列表的求和为我提供了一个列表,而不是总结其中的元素
我正在尝试从彼此之间的4个列表中总结。例如,第一个列表中的第一个元素,然后是第二个元素等,
但是我没有得到一个带有四个元素的嵌套列表,我不明白为什么以及如何求解它。
#dependency influence calculation
def dep_Influence(a,b,c,d,decimal):
influence=[]
for i in range(len(a)):
x=float(a[i])+0,5*float(b[i])+0,33*float(c[i])+0,25*float(d[i])
influence.append(x)
influence = np.around(influence,decimal)
return influence
I am trying to sum from 4 lists there elements with each other. For a example the first element from fours lists, then the second element etc
But instead of that i am getting a list with nested lists with the four elements and i cannot understand why and how to solve it.Any ideas?
#dependency influence calculation
def dep_Influence(a,b,c,d,decimal):
influence=[]
for i in range(len(a)):
x=float(a[i])+0,5*float(b[i])+0,33*float(c[i])+0,25*float(d[i])
influence.append(x)
influence = np.around(influence,decimal)
return influence
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当乘以浮点数时,使用点代替逗号来表示这些值:
When multiplying by float numbers, use points instead of commas to represent those values: