Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.31 KB | None | 0 0
  1. def BinPow(a, n, fun):
  2.     if n == 1:
  3.         return fun(a)
  4.     else:
  5.         def BinPow1(a1, n1):
  6.             if n1 == 1:
  7.                 return fun(a1)
  8.             else:
  9.                 return BinPow1(fun(a1), n1 - 1)
  10.  
  11.         return (BinPow1(fun(a), n - 1))
  12.  
  13.  
  14. print(BinPow("Se", 7, str.__add__))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement