def power(a, b): if b==0: return 1 return a*power(a, b-1)print "----power---",power(6,2)#ORdef power(a, b): if b==0: return 1 result = a*power(a, b-1) return resultprint "----power---",power(2,5)Output=======----power--- 36----power--- 32
No comments:
Post a Comment