python遞歸實現序列求和

def mysum(items): head,*tail = items return head+sum(tail) if tail else  head 每次加列表尾部的首部,遞歸終止條件是 tail列表爲空 *符號的用法
相關文章
相關標籤/搜索