Below is a function expo(x,y) that takes in two positive integers x and y, and returns the exponent xy using

Below is a function expo(x,y) that takes in two positive integers x and y, and returns the exponent xy using only nested for loops and the addition operator. Rewrite the function by converting both for loops into while loops.

You are not required to understand how the function below works (though I encourage you to try and figure it out), just how to convert the for loops into while loops.

Submit your code to gradescope in a file called ex4-5.py.

def expo(x,y):

prod = 1

for i in range(y):

total = 0

for j in range(x):

total += prod

prod = total

return prod

Complete Answer:

Get Instant Help in Homework Asap
Get Instant Help in Homework Asap
Calculate your paper price
Pages (550 words)
Approximate price: -
Open chat
1
Hello 👋
Thank you for choosing our assignment help service!
How can I help you?