【发布时间】:2019-04-29 10:20:36
【问题描述】:
我还想输入十进制数字。我试过float,但没用。
这是我需要更正的代码:
a = input()
b = input()
list1 = list(map(int, a.split()))
list2 = list(map(int, b.split()))
garums1 = len(list1)
garums2 = len(list2)
summa=0
for i in range(len(list1)):
if garums1==garums2:
summa=list1[i]/list2[i]
print(round(summa,1), end=" ")
代码有效
1 2 3 4
2 3 4 5
0.5 0.7 0.8 0.8
也需要这样的东西
1.23 4.1 51.3 44
2 4.1 4 5
0.6 1.0 12.8 8.8
【问题讨论】:
标签: python python-3.x list input decimal