0
有沒有什麼辦法通過assert語句來檢查函數參數的存在?python中聲明語句的參數存在
def fractional(x) :
assert x==None, "argument missing" <---- is it possible here to check?
assert type(x) == int, 'x must be integer'
assert x > 0 , ' x must be positive '
output = 1
for i in range (1 , int(x)+1) :
output = output*i
assert output > 0 , 'output must be positive'
return output
y=3
fractional() <----- argument missing