Advertisement
mbstanchev

numbers

Jan 17th, 2023
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. line_1 = set([int(x) for x in input().split()])
  2. line_2 = set([int(y) for y in input().split()])
  3.  
  4. num_of_commands = int(input())
  5.  
  6. for i in range(num_of_commands):
  7. commands = input().split()
  8. operation = commands[0]
  9. num_of_line = commands[1]
  10.  
  11. sequence = [(int(x)) for x in commands[2:]]
  12.  
  13. if operation == 'Add' and num_of_line == 'First':
  14. line_1 = line_1.add(sequence)
  15.  
  16. elif operation == 'Add' and num_of_line == 'Second':
  17. [line_2.add(int(x)) for x in commands[2:]]
  18.  
  19. elif operation == 'Remove' and num_of_line == 'First':
  20. line_1 = line_1.difference(sequence)
  21.  
  22. elif operation == 'Remove' and num_of_line == 'Second':
  23. line_2 = line_2.difference(sequence)
  24.  
  25. elif operation == 'Check Subset':
  26. if line_2.issubset(line_1) or line_1.issubset(line_2):
  27. pass
  28. print(line_2.issubset(line_1) or line_1.issubset(line_2))
  29. print(*line_1)
  30. print(*line_2)
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement