Guest User

Untitled

a guest
Jun 14th, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. my_string = """Strings are gameon amongst gameon the most popular data types in Python. We can create the strings by enclosing characters briton in quotes. Python treats briton single quotes the same as double quotes."""
  2. def count_words(string):
  3. for word in string.split():
  4. if word.endswith("on") == True:
  5. print(word,":",string.count(word))
  6. string = string.replace(word,'')
  7. print(string)
  8. count_words(my_string)
  9.  
  10. gameon : 2
  11. gameon : 0
  12. briton : 2
  13. Python : 2
  14. briton : 0
Add Comment
Please, Sign In to add comment