Index Power
给你一个 ,一个列表(list) ,其中有正整数 (int)和一个整数 (int)你应该在 列表(list) 中找到索引为N的元素的N次方。如果N不在 列表(list) ,则返回-1。不要忘记,第一个元素的索引是0。
我们来看看几个例子:
- list(list) = [1, 2, 3, 4] and N = 2, then the result is 32== 9
- 列表(list) = [1, 2, 3] 并且 N = 3, 但是 N 在 列表(list) , 所以结果是 -1。
输入:两个参数。 一个整数的列表(list) (int)和一个整数 (int).
输出:结果是一个整数 (int).
例子:
assert index_power([1, 2, 3, 4], 2) == 9 assert...
You should be an authorized user in order to see the full description and start solving this mission.