Define Function:
def Binomial(n, m): if( n == m or m ==0): return 1 else: return (Binomial(n - 1, m) + Binomial(n - 1, m - 1)) print(Binomial(5,3))
Default Argument Values:
def Binomial(n = 5, m = 3): if( n == m or m ==0): return 1 else: return (Binomial(n - 1, m) + Binomial(n - 1, m - 1)) print(Binomial())
參考資料:
http://docs.python.org/3/tutorial/controlflow.html#defining-functions
http://writecodepeople.blogspot.tw/2013/07/binomial-coefficient.html