I am finding it difficult to interpret what the below code is trying to do . It is about the recursive algorithm . Especially the: if tail else head statement.
Assuming a list is defined and split into head and tail components
items=[1,10,7,4,5,9]
head,*tail=items
def sum(items):
head,tail=items
return head+sum(tail) if tail else head
itemsarray