0 out of 464 challenges solved
Write a Python function `power_base_sum(base, power)` that calculates the sum of all digits of the number obtained by raising `base` to the power of `power`. #### Example Usage ```python [main.nopy] power_base_sum(2, 100) # Expected output: 115 power_base_sum(8, 10) # Expected output: 37 power_base_sum(3, 3) # Expected output: 9 ``` #### Constraints - `base` and `power` are positive integers. - The result of `base**power` will always fit in memory.
def power_base_sum(base, power):
"""
Calculate the sum of all digits of the number obtained by raising `base` to the power of `power`.
Args:
base (int): The base number.
power (int): The exponent.
Returns:
int: The sum of the digits of the result.
"""
# Calculate the power result
# Convert the result to a string and iterate through its digits
# Sum the digits and return the result
pass