# Python Program for Calculating the Sum of a List of Numbers using recursion

In this example, we will write a recursive function to convert decimal to binary. To better understand this example, make sure you have knowledge of the following tutorials:-

## Python Program for Calculating the Sum of a List of Numbers using recursion

1 2 3 4 5 6 7 | def listsum(numList): if len(numList) == 1: return numList[0] else: return numList[0] + listsum(numList[1:]) print(listsum([1, 2, 3, 5, 7, 9])) |

The output of the above program is:-

27

## Recent Comments