7. Can you find an error or problem with the above code? Think about what happens if we evaluate check(3). What output would be produced by Python? Explain the reason(s) behind the output.

def check(n) :
if n <= 1:
return True
elif n % 2 == 0 :
return check(n/2)
else :
return check(n/1)

Yes, The above function will only work when the number is a power of 2. It will result in infinite recursion when n is not a power of 2. check(3) will result in an infinite recursion. The reason is that in the last else statement the funtion is calling itself without any change to the number n : check(n/1)