Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- n=int(input())
- myList=[]
- for i in range(n):
- next_number=input()
- myList.append(next_number)
- mostFreqenNum = {}
- contMostnum = 0
- #myList = [4 ,1 ,1, 4 ,2, 3, 4, 4, 1 ,2, 4, 9, 3]
- for i in myList:
- if i in mostFreqenNum:
- mostFreqenNum[i] += 1
- else:
- mostFreqenNum[i] = 1
- for x in mostFreqenNum:
- if mostFreqenNum[x] > contMostnum:
- contMostnum = mostFreqenNum[x]
- mostFreqKey = x
- else:
- continue
- print(f' {mostFreqKey} ({contMostnum} times)')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement