更新
This commit is contained in:
20
Python-100-Days/Day01-15/Day06/function1.py
Normal file
20
Python-100-Days/Day01-15/Day06/function1.py
Normal file
@@ -0,0 +1,20 @@
|
||||
"""
|
||||
|
||||
函数的定义和使用 - 计算组合数C(7,3)
|
||||
|
||||
Version: 0.1
|
||||
Author: 骆昊
|
||||
Date: 2018-03-05
|
||||
|
||||
"""
|
||||
|
||||
|
||||
# 将求阶乘的功能封装成一个函数
|
||||
def factorial(n):
|
||||
result = 1
|
||||
for num in range(1, n + 1):
|
||||
result *= num
|
||||
return result
|
||||
|
||||
|
||||
print(factorial(7) // factorial(3) // factorial(4))
|
||||
Reference in New Issue
Block a user