首页 > 代码库 > 自定义函数multi()实现多个数求积

自定义函数multi()实现多个数求积

# multiply 
def multi(a):
    s=1
    for i in a:
        s*=i
    return s
def inp():
    a=input(please input nums(split with comma):)
    return a
if __name__==__main__:
    try :
        a=inp()
        result=multi(eval(a)) 
        print (the result of multipling is :,result)
    except:
        print ("please input with the correct information")
    finally :
        print (thanks)
        

 

自定义函数multi()实现多个数求积