programming-examples/python/Math/Calculate the sum of all digits of the base to the specified power.py

6 lines
165 B
Python
Raw Normal View History

2019-11-15 12:59:38 +01:00
def power_base_sum(base, power):
return sum([int(i) for i in str(pow(base, power))])
print(power_base_sum(2, 100))
print(power_base_sum(8, 10))