def power(num, x=1):
result = 1
for i in range(x):
result = result * num
return result
print(power(num=2, x=3))
This is a Python function with a for loop in it that is supposed to print out the power of something but I am not sure how this code is working because the result is result * num.
Can someone please explain how this is returning 8 as answer, because if I multiply num with result, I get 6?