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
|
1517 Discussions
|
Please Login in order to post a comment
Using sets specifcally:
I should have used counter, but works too with defaultdict (used as counter)
k=int(input("enter: ")) n=tuple(map(int, input("enter: ").split())) for i in n: if n.count(i)>1: pass else: print(i)
from collections import Counter k = int(input()) s = Counter(map(int,input().split())) print(s.most_common()[-1][0])
My Approach is this;