码迷,mamicode.com
首页 > 编程语言 > 详细

python中数学计算

时间:2017-03-14 17:33:07      阅读:181      评论:0      收藏:0      [点我收藏+]

标签:排列组合   python   ==   turn   log   code   组合   nbsp   数学计算   

用python实现排列组合C(n,m) = n!/m!*(n-m)!  

def get_value(n):  
    if n==1:  
        return n  
    else:  
        return n * get_value(n-1)       
def gen_last_value(n,m):  
     first = get_value(n)  
     second = get_value(m)  
     third = get_value((n-m))  
     return first/(second * third) 

 

python中数学计算

标签:排列组合   python   ==   turn   log   code   组合   nbsp   数学计算   

原文地址:http://www.cnblogs.com/lcgsmile/p/6549548.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!