Python | Print similar element in two sets.

In this program, we will take two input set from the user and print a similar element in the sets. Implementation: s = set(input("enter set elements"))
s1 = set(input("enter set elements"))
h = set()
for i in s:
for e in s1:
if i==e:
h.add(i)
print("same elements are",h) Output:
enter set elements1254789
enter set elements1459874
same elements are {'8', '7', '1', '4', '5', '9'} Happy Coding! Follow us on Instagram @programmersdoor Join us on Telegram @programmersdoor Please write comments if you find any bug in the above code/algorithm, or find other ways to solve the same problem. Follow Programmers Door for more. #blog #interview #placement #learn #computer #science

        Contact Us

programmersdoor@gmail.com

  • LinkedIn
  • Facebook
  • Instagram

©2023 by Programmers Door