Advertisement
pacho_the_python

Untitled

Apr 3rd, 2022
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.54 KB | None | 0 0
  1. some_words = input().split(" | ")
  2.  
  3. words = {}
  4.  
  5. for i in some_words:
  6.     data = i.split(":")
  7.     key = data[0]
  8.     value = data[1].strip()
  9.  
  10.     if key not in words:
  11.         words[key] = [value]
  12.     else:
  13.         words[key].append(value)
  14.  
  15.  
  16. test_words = input().split(" | ")
  17.  
  18. command = input()
  19.  
  20. if command == "Hand Over":
  21.     for x in words:
  22.         print(x, end=" ")
  23.  
  24. elif command == "Test":
  25.     for j in test_words:
  26.         if j in words:
  27.             print(f"{j}:")
  28.             for k in words[j]:
  29.                 print(f" -{k}")
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement