Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
67190 胡海峰老师 函数求和 Python3 Accepted 29 MS 3748 KB 362 2024-03-15 18:18:57

Tests(1/1):


Code:

def sumab(x,y): """ 把x+(x+1)+(x+2)+……+ (y-1) + y的和求出来(连加) :param x: 连加的第【1】个数 :param y: 连加的第【最后一】个数 :return: 连加的结果 """ tot = 0 for i in range(x,y+1): tot +=i print(tot) lst=[(1,10),(20,30),(35,45)] for tp in lst: sumab(tp[0],tp[1])