• + 2 comments

    we should select the proper range otherwise the list becomes out of order, but in this example no need(can select range(0, n))

    def birthday(s, d, m, n):
      count = 0
      for i in range(n-m+1):
        if(sum(s[i:m+i])==d):
            count = count + 1
      return count
    

    Any quasions, fell free to ask.