Advertisement
WupEly

Untitled

Mar 31st, 2023
23
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. n = int(input())
  2. lines = []
  3.  
  4.  
  5. while True:
  6. if len(lines) == 2 * n:
  7. break
  8. lines.append(input().split(' ? '))
  9.  
  10. # ["1 ? 2 ? 3 ? 4 ? 5", "1 ? 2 ? 3 ? 4 ? 5"] 1
  11. # [['1', '2', '3', '4', '5'], ['1', '2', '3', '4', '5']] 2
  12.  
  13. suit_nums = [[] for i in range(n)]
  14.  
  15. for i in range(1, len(lines)+1, 2):
  16. for num in lines[i]:
  17. if int(num) % 2 == 0 and num not in lines[i-1]:
  18. suit_nums[i // 2].append(num)
  19.  
  20. for line in suit_nums:
  21. if line:
  22. print(" * ".join(line))
  23. else:
  24. print()
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement