| 
 就是高中數學的那個排列組合的組合,C。從 n 樣東西里,取出 m 樣,計算有幾種取法 就是那個組合的 nCm 公式寫出來就是 n!/( (n-m)!*m! ) - # Import math Library
 
 - import math
 
  
- # Initialize the number of items to choose from
 
 - n = 7
 
  
- # Initialize the number of possibilities to choose
 
 - k = 5
 
  
- # Print total number of possible combinations
 
 - print (math.comb(n, k))
 
  複製代碼The result will be:  
 21  
 |