python 输出所有列表元素的乘积

 

def multiply_list(items):  
    tot = 1  
    for x in items:  
        tot *= x  
    return tot  
print(multiply_list([1,2,-8]))

  

posted @ 2018-11-16 20:05  anobscureretreat  阅读(977)  评论(0编辑  收藏  举报