Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def occurence_mot_texte(mot, texte):
- compteur, long_texte, long_mot = 0, len(texte), len(mot)
- for i in range(long_texte - long_mot + 1):
- j = 0
- while j < long_mot and mot[j] == texte[i+j]:
- j += 1
- if j == long_mot:
- compteur += 1
- return compteur
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement