Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

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
Comment

PREVIOUS NEXT
Code Example
Python :: spark write progress bar jupyter 
Python :: how to save multiple choices in django site:stackoverflow.com 
Python :: generator expressions python 
Python :: comment arrĂȘter un jeu en appuyant sur une touche python 
Python :: django create view filter options 
Python :: python3 netifaces get current interface 
Python :: arma-garch python 
Python :: pythongalaxy.com 
Python :: par e impar pygame 
Python :: gdal user with anaconda 
Python :: python consecutive numbers difference between 
Python :: jupyter_ascending 
Python :: qtile: latest development version 
Python :: DRf Representation 
Python :: fibonacci sequence generator python 
Python :: convert python to java online 
Python :: EMAIL_BACKEND where to read 
Python :: RuntimeError: cuda runtime error (711) : peer mapping resources exhausted at /pytorch/aten/src/THC/THCGeneral.cpp:139 
Python :: concatenar columnas en una del mismo dataset 
Python :: cross-validation sklearn image classification 
Python :: numpy transpose shorthand 
Python :: python find matching string regardless of case 
Python :: pygame is not defined 
Python :: python argparse one or the other 
Python :: str.format() 
Python :: sliding window maximum 
Python :: load xgb 
Python :: how parse date python no specific format 
Python :: PHP echo multi lines Using Heredoc variable 
Python :: unique character 03 
ADD CONTENT
Topic
Content
Source link
Name
2+6 =