• + 1 comment

    That't beutiful thank you for sharing : i did this way but we can make way shorter by yours..

    1. num=0
    2. for i in range(len(s)):
    3. if sum(s[i:i+m])==d:
    4. num+=1
    5. return(num)