We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Python
- Sets
- The Captain's Room
- Discussions
The Captain's Room
The Captain's Room
Sort by
recency
|
1500 Discussions
|
Please Login in order to post a comment
a = int(input())
set_a = list(map(int, input().split()))
seen_once = set()
seen_multiple = set()
for i in set_a: if i in seen_once: seen_multiple.add(i) else: seen_once.add(i) unique_elements = seen_once - seen_multiple for element in unique_elements: print(element)
from collections import Counter
k = int(input())
room_no = list(map(int,input().split()))
room_count = Counter(room_no)
for keys, values in room_count.items():
if values < 5: print(keys)
here's my code:
k=int(input ()) s=list(map(int, input() .split())) s1=set() s2=set() for i in s: if i in s1: s2. add (i) else: s1. add (i) result=s1-s2 print (*result)
Here's my code:
from collections import Counter k = int(input()) room = list(map(int, input().split())) count = Counter(room) for k,v in count.items(): if v == 1: print(k)