python递归实现序列求和

def mysum(items): head,*tail = items return head+sum(tail) if tail else  head 每次加列表尾部的首部,递归终止条件是 tail列表为空 *符号的用法
相关文章
相关标签/搜索