python3-sum()函数
sum(iterable, start=0, /)
Return the sum of a 'start' value (default: 0) plus an iterable of numbers
When the iterable is empty, return the start value.
This function is intended specifically for use with numeric values and may
reject non-numeric types.
返回一个“start”值(默认为0)加上一个可迭代的数字的和
当可迭代为空时,返回起始值。
此函数专门用于数值,可能会拒绝非数值类型。
square3 = [val for val in range(0,101)] print(sum(square3))