naren_paste

Union of 2 sets

Jul 30th, 2024
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.36 KB | Source Code | 0 0
  1. s = set(input('Enter first set of characters: '))
  2. t = set(input('Enter second set of characters: '))
  3. print('Set 1:', s)
  4. print('Set 2:', t)
  5. union_set = s.union(t)
  6. print('Union of the two sets:', union_set)
  7.  
  8. # The output will be:
  9. Set 1: {'a', 'p', 'l', 'e'}
  10. Set 2: {'r', 'a', 'n', 'g', 'e', 'o'}
  11. Union of the two sets: {'a', 'p', 'l', 'e', 'r', 'n', 'g', 'o'}
Advertisement
Add Comment
Please, Sign In to add comment