摘要: 1 def fact(n):2 if n==1:3 return 14 return n*fact(n-1)5 6 n=int(raw_input("Please Input The Number of N: "))7 print fact(n) 阅读全文
posted @ 2015-05-30 12:06 Curious-Python 阅读(134) 评论(0) 推荐(0)
摘要: 1 def my_abs(x):2 if x>=0:3 return x4 else:5 return -x6 7 z=int(raw_input("Please Input The Number You Want To Get Abs: "))8 ... 阅读全文
posted @ 2015-05-30 11:58 Curious-Python 阅读(175) 评论(0) 推荐(0)
摘要: 1 #定义X的N次方的函数,然后调用函数 2 def power(x,n): 3 s=1 4 while n>0: 5 n=n-1 6 s=s*x 7 return s 8 9 a=power(5,2)10 b=power(5,3)11 p... 阅读全文
posted @ 2015-05-29 20:38 Curious-Python 阅读(86) 评论(0) 推荐(0)
点击右上角即可分享
微信分享提示