base = 3
exponent = -4
result = pow(base, exponent)
print("Answer = " + str(result))
base = 3
exponent = 4
result = 1
while exponent != 0:
result *= base
exponent-=1
print("Answer = " + str(result))
the ** operator is used for power
base ** exponent
example :
2 ** 4
same as :
2 * 2 * 2 * 2
equals :
16
base = 3
exponent = 4
result = 1
for exponent in range(exponent, 0, -1):
result *= base
print("Answer = " + str(result))