Python练习1

 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 print a,b

 

posted @ 2015-05-29 20:38  Curious-Python  阅读(89)  评论(0)    收藏  举报