Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
| Beide Seiten der vorigen Revision Vorhergehende Überarbeitung | |||
| modul:m323:learningunits:lu02:loesungen:pure1 [2024/08/28 13:30] – kmaurizi | modul:m323:learningunits:lu02:loesungen:pure1 [2024/08/28 13:31] (aktuell) – kmaurizi | ||
|---|---|---|---|
| Zeile 16: | Zeile 16: | ||
| """ | """ | ||
| Recursively calculates the sum of a list of numbers. | Recursively calculates the sum of a list of numbers. | ||
| - | | + | |
| - | | + | :param numbers: A list of integers. |
| - | | + | |
| - | + | :return: The sum of the numbers in the list. | |
| - | | + | :rtype: int |
| - | int: The sum of the numbers in the list. | + | |
| + | The function operates recursively, | ||
| + | with the sum of the remaining elements. If the list is empty, the function | ||
| + | returns 0 as the base case. | ||
| """ | """ | ||
| if not numbers: | if not numbers: | ||