跪求大佬指点
def sub_sum(L): index = 0 sum1 = 0 sum2 = 0 for item in L: if index % 2 == 0: sum1 += item else: sum2 += item index += 1 return sum1, sum2 L = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] result = sub_sum(L)
index 在这里代表什么意思
sum1+=x 又是什么意思
求大佬指点
def sub_sum(L): index = 0 sum1 = 0 sum2 = 0 for item in L: if index % 2 == 0: sum1 += item else: sum2 += item index += 1 return sum1, sum2 L = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] result = sub_sum(L)
index 在这里代表什么意思
sum1+=x 又是什么意思
求大佬指点
2020-09-29
举报