Advertisement
fkudinov

10. Popular Words / Вирішуємо задачі на Python CheckIO Українською

Dec 7th, 2023
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.61 KB | Source Code | 0 0
  1.  
  2. def popular_words(text: str, words: list) -> dict:
  3.     return {}
  4.  
  5.  
  6.  
  7. if __name__ == '__main__':
  8.     print("Example:")
  9.     print(popular_words('''
  10. When I was One
  11. I had just begun
  12. When I was Two
  13. I was nearly new
  14. ''', ['i', 'was', 'three', 'near']))
  15.  
  16.     # These "asserts" are used for self-checking and not for an auto-testing
  17.     assert popular_words('''
  18. When I was One
  19. I had just begun
  20. When I was Two
  21. I was nearly new
  22. ''', ['i', 'was', 'three', 'near']) == {
  23.         'i': 4,
  24.         'was': 3,
  25.         'three': 0,
  26.         'near': 0
  27.     }
  28.     print("Coding complete? Click 'Check' to earn cool rewards!")
Tags: checkio
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement