赞
踩
# 6的阶乘:6*5*4*3*2*1 # 3的阶乘:3*2*1
- i = 5
- result = 6
- while i >= 1:
- result = result * i
- print(result)
- i = i - 1
-
- def get_jiecheng(number):
- result = 1
- while number > 0:
- result *= number
- number -= 1
- return result
-
- print("jiecheng 6 = " ,get_jiecheng(6))
- print("jiecheng 3 = " ,get_jiecheng(3))
- print("jiecheng 100 = " ,get_jiecheng(100))
-
- def get_jiecheng(number):
- result = 1
- while number>0:
- result *= number
- number -= 1
- return result
- print (get_jiecheng(6))
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。