Raise to Power
A power tells how many times a number should be multiplied by itself. Write a function power that computes base^exp, where exp is a non-negative integer. If exp = 0, the result is always 1, including the 0^0 case for this function.
Примеры
Ввод
2, 10Вывод
1024Ввод
3, 0Вывод
1Ввод
5, 3Вывод
125Нужно реализовать
def power(base: int, exp: int) -> int:
Теги
mathrecursion
Inicia sesión para ver tu historial de envíos
Iniciar sesiónInicia sesión para usar el AI Mentor
Iniciar sesiónVisible tests
1
Input
2, 10Expected
10242
Input
3, 0Expected
13
Input
5, 3Expected
1254
Input
0, 0Expected
15
Input
10, 4Expected
100006
Input
2, 0Expected
1Focus radio
Paused · SomaFM · Fluid