Python 代码实现求一组数的和
以下是一个使用 Python 编写的求一组数和的代码:
def sum_of_numbers(numbers):
sum = 0
for num in numbers:
sum += num
return sum
# 测试代码
numbers = [1, 2, 3, 4, 5]
print(sum_of_numbers(numbers))
输出结果为:15
原文地址: https://www.cveoy.top/t/topic/poBL 著作权归作者所有。请勿转载和采集!