标签:color span def 写代码 bsp 代码 print get range
‘‘‘ def get_sum(a,b): #写代码, 输出结果 # get_sum(1, 0) == 1 // 1 + 0 = 1 # get_sum(1, 2) == 3 // 1 + 2 = 3 # get_sum(0, 1) == 1 // 0 + 1 = 1 # get_sum(1, 1) == 1 // 1 Since both are same # get_sum(-1, 0) == -1 // -1 + 0 = -1 # get_sum(-1, 2) == 2 // -1 + 0 + 1 + 2 = 2 ‘‘‘ def get_sum(a,b): return sum(range(min(a, b),max(a, b)+1)) res = get_sum(3,-8) print(res)
标签:color span def 写代码 bsp 代码 print get range
原文地址:https://www.cnblogs.com/q1ang/p/9344658.html