Calculate Power of a Number
Calculate Power of a Number
Tags: Basics
Credit: CodingChallenge
Difficulty: Beginner
Type: Text
Category: Practice
Time Allowed: 5 s
Description:
Write a function that takes two numbers, base and exponent, and returns the result of raising the base to the power of the exponent using built-in functions. This problem is designed to help you practice using built-in functions for exponentiation
. The function should accept two parameters and return the result.
Constraints:
- The base and exponent inputs will be
integers
orfloats
. - The function should
return
anumber
representing the result. - Use built-in functions like
pow()
.
Example:
- Input:
2, 3
- Output:
8
Test Case | Input | Expected Output |
---|---|---|
1 | [2, 3] | 8 |
2 | [5, 0] | 1 |
3 | [2, -2] | 0.25 |
4 | [9, 0.5] | 3.0 |
5 | [10, 2] | 100 |
Leave a Comment
Please login to leave a comment.