Advertisement
Guest User

Untitled

a guest
Apr 24th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. #!/usr/bin/env/python3
  2. #W danym tekscie A wskazac wszystkie miejsca wystapienia danego tekstu B(5.10)
  3.  
  4. A='Dzien dobry,milego dnia, Dzien dobry'
  5. B='Dzien dobry'
  6. lastOccurence = 0
  7. for i in range(len(A)):
  8. position = A[lastOccurence::].find(B)
  9. if position < 0:
  10. break
  11.  
  12. print(lastOccurence + position)
  13. lastOccurence = lastOccurence + position + len(B)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement