Advertisement
Guest User

Untitled

a guest
Dec 6th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. def occurence_mot_texte(mot, texte):
  2. compteur, long_texte, long_mot = 0, len(texte), len(mot)
  3. for i in range(long_texte - long_mot + 1):
  4. j = 0
  5.  
  6. while j < long_mot and mot[j] == texte[i+j]:
  7.  
  8. j += 1
  9.  
  10. if j == long_mot:
  11. compteur += 1
  12.  
  13. return compteur
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement