I could not think of any better way to raise to power, except this, but how do I refactor it? I should only use while loop, not for loop, not x**y.
result = 1
base = 3
counter = 1
degree = 4
while counter <= degree:
result = base * result
counter += 1
print("counter %d and the result %d" %(counter, result))
print("result is ", result)
math.exp(y*math.log(x))
- ormath.pow(x,y)
be acceptable? (is this a precision problem?) – LSerni Apr 29 '16 at 6:48result = base * result
can chage toresult *= base
– piRSquared Apr 29 '16 at 7:19