10. Check Point 6.1 has some recursive functions that cause infinite recursion. Make changes in the definitions of those recursive functions so that they recur finitely and produce a proper output.

# Checkpoint 6.1
(b)
def recur(p):
if p == 0:
print(“##”)
else:
recur(p)
p = p-1
recur(5)

# The above code will run into infinite recursion because the value of p is being decremented after the recursion call. So it is never actually changing. The correct way:
def recur(p):
if p == 0:
print(“##”)
else:
p = p-1
recur(p)
recur(5)

(d)
def Check(c) :
Mate(c+1)
def Mate(d) :
Check(d-1)
# The above code has no base case and will run into infinite recursion. It can be corrected as following

def Check(c):
if c > 10: # Any base case can be added
return
else:
c = c+1 # Increment is important
Mate(c+1)
def Mate(d) :
Check(d-1)