Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

# work and upload your solutions. If you get # stuck on a problem, go on to the

ID: 3568706 • Letter: #

Question


# work and upload your solutions. If you get # stuck on a problem, go on to the next; however, # if you leave n problem completely blank I can't give you # any partial credit. # Problem 1. Write the 'ispower' function below. This function is passed parameters x and y and returns True or False, depending on whether or not x is a power of y. You may NOT use any of the functions from the math module. Here are some examples: > > > ispower(4,2) True > > > ispower(32,4) False > > > ispower(243,3) True def ispower (x,y): pass

Explanation / Answer

def ispower(x,y):
while(x != y):
if(x%y != 0):
return False
else:
x = x/y

if(x == y):
return True;