Reference Link:
正文
ls = []
input1 = list(map(int,input().strip().split()))
# 空行作为循环停止的判定
# https://blog.csdn.net/R72692/article/details/119352176
# python 判断矩阵为空
# https://blog.csdn.net/u012759006/article/details/89177135
while any(input1):
ls.append(input1)
print(ls)
input1 = list(map(int,input().strip().split()))
print(len(ls)) # Python中如何获取二维列表的行数和列数
print(len(ls[0])) # Python中如何获取二维列表的行数和列数
for i in range(len(ls)):
kk = []
kk.append(ls[i][0])
for j in range(ls[i][1]-1):
kk.append(math.sqrt(kk[j]))
print("{:.2f}".format(sum(kk)))
运行结果如下: