Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Calculator(object):
- def power(self, n, p):
- if (n < 0) or (p < 0):
- raise Exception("n and p should be non-negative")
- else:
- return n ** p
- myCalculator = Calculator()
- time = int(input())
- for i in range(time):
- n, p = map(int, input().split())
- try:
- ans = myCalculator.power(n, p)
- print(ans)
- except Exception as e:
- print(e)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement