Answers for "print number of times the string strfind appears in the string (first second parent city) hackerrank"

0

find a string hackereank

def count_substring(string, sub_string):
    count=0  #initialise count variable
    for i in range(0,len(string)):
        if string[i:].startswith(sub_string): # basically it traverses from left to right and looks for occurence of substring
            count+=1 #every time count will increase by 1

    return count
Posted by: Guest on July-01-2020

Code answers related to "print number of times the string strfind appears in the string (first second parent city) hackerrank"

Python Answers by Framework

Browse Popular Code Answers by Language