fork download
  1. def sum_of_list(numbers):
  2. """
  3. Calculate the sum of a list of integers.
  4.  
  5. Parameters:
  6. numbers (list): A list of integers.
  7.  
  8. Returns:
  9. int: The sum of the integers in the list.
  10. """
  11. return sum(numbers)
  12.  
  13. # Example usage:
  14. numbers = [1, 2, 3, 4, 5]
  15. result = sum_of_list(numbers)
  16. print("The sum of the list is:", result)
Success #stdin #stdout 0.03s 9564KB
stdin
Standard input is empty
stdout
The sum of the list is: 15