Article From:https://www.cnblogs.com/sea-stream/p/9971368.html

 

def list_sum(num_List):
    if len(num_List) == 1:
        return num_List[0]
    else:
        return num_List[0] + list_sum(num_List[1:])
        
print(list_sum([2, 4, 5, 6, 7]))

 

Link of this Article: Recursive summation of Python list

Leave a Reply

Your email address will not be published. Required fields are marked *