Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Index Power by diwert-ai
def index_power(array: list, n: int) -> int:
return array[n]**n if n < len(array) else -1
print('Example:')
print(index_power([1, 2, 3], 2))
assert index_power([1, 2, 3, 4], 2) == 9
assert index_power([1, 3, 10, 100], 3) == 1000000
assert index_power([0, 1], 0) == 1
assert index_power([1, 2], 3) == -1
print("The mission is done! Click 'Check Solution' to earn rewards!")
Aug. 23, 2022
Comments: