Find Powers
Tags: Basics
Credit: CodingChallenge
Difficulty: Beginner
Type: Text
Category: Practice
Time Allowed: 5 s
Description:
Write a function that takes two parameters: a list of integers
and an integer
exponent. The objective is to return a list of integers
where each of the provided numbers have been raised to the power of the exponent. You should use the provided helper function to perform the calculation. This problem is designed to help you practice creating and calling custom functions
. The helper function should accept two parameters and return the result.
Constraints:
- The list and exponent inputs will be
integers
. - Exponent can be zero or positive integer.
- The helper function should
return
aninteger
representing the result. - You should use the helper function.
Example:
- Input:
[2, 3, 4], 3
- Output:
[8, 27, 64]
Test Case | Input | Expected Output |
---|---|---|
1 | [2, 3, 4], 3 | [8, 27, 64] |
2 | [2, 3, 4], 2 | [4, 9, 16] |
3 | [5, 4, 3, 2, 1], 1 | [5, 4, 3, 2, 1] |
4 | [2, 4, 1, 5, 3], 0 | [1, 1, 1, 1, 1] |
Leave a Comment
Please login to leave a comment.