1 #! /usr/bin/python3 2 # -- coding:UTF-8 -- 3 4 import math 5 def power(x, n): 6 s = 1 7 while n > 0: 8 n = n - 1 9 s = s * x 10 return s 11 12 a = int(input('请输入x:')) 13 b = int(input('请输入n:')) 14 print (power(a,b))
Sign in to make a reply
休耕
1 #! /usr/bin/python3 2 # -- coding:UTF-8 -- 3 4 import math 5 def power(x, n): 6 s = 1 7 while n > 0: 8 n = n - 1 9 s = s * x 10 return s 11 12 a = int(input('请输入x:')) 13 b = int(input('请输入n:')) 14 print (power(a,b))