Advertisement
pacho_the_python

Word Synonyms

Mar 14th, 2022
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.30 KB | None | 0 0
  1. num = int(input())
  2.  
  3. synonyms = {}
  4.  
  5. for i in range(1, num + 1):
  6.     word = input()
  7.     word_value = input()
  8.     if word not in synonyms:
  9.         synonyms[word] = []
  10.  
  11.     synonyms[word].append(word_value)
  12.  
  13. for y in synonyms:
  14.     strings = ", ".join(synonyms[y])
  15.     print(f"{y} - {strings}")
  16.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement