79208612

Date: 2024-11-20 19:04:55
Score: 1
Natty:
Report link

came after here some time and re-wrote the code for the exact problem, which can be useful to someone who is learning about recursion.

def re(num, index):
    
    if index >= len(num):
        return 0
    
    if num[index] == "0":
        return 1 + re(num, index + 1)
    else:
        return re(num,index + 1)
Reasons:
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Shashank Mingwal