Unit 2 Task 42 - Solution

Learn to code with step-by-step lessons. A place for students to work through programming fundamentals and build skills.

Solution - Task 42: Powers by repeated multiplication

← Back to task


One possible program:

base = int(input("base: "))
exp = int(input("exponent (>=0): "))
result = 1

for repeat in range(exp):
    result *= base

print(result)