Bad_Programist

Untitled

Nov 18th, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.24 KB | None | 0 0
  1. def P(a, n):
  2.     if n == 1:
  3.         return a
  4.     if n % 2 == 0:
  5.         return P(a * a, n//2)
  6.     else:
  7.         return a * P(a, n-1)
  8. a = float(input())
  9. if float.is_integer(a) == True:
  10.     a = int(a)
  11. b = int(input())
  12. S = P(a, b)
  13. print(S)
Advertisement
Add Comment
Please, Sign In to add comment