这是👉python 递归函数👈的摘要
递归函数
举个例子,我们来计算阶乘 n! = 1 * 2 * 3 * ... * n
看阶乘的规律
1! = 1
2! = 2 × 1 = 2 × 1!
3! = 3 × 2 × 1 = 3 × 2!
4! = 4 × 3 × 2 × 1 = 4 × 3!
...
n! = n × (n-1)!
说白了,递归函数,就是自己调用自己!
2018.1.8
举个例子,我们来计算阶乘 n! = 1 * 2 * 3 * ... * n
1! = 1
2! = 2 × 1 = 2 × 1!
3! = 3 × 2 × 1 = 3 × 2!
4! = 4 × 3 × 2 × 1 = 4 × 3!
...
n! = n × (n-1)!
说白了,递归函数,就是自己调用自己!