0
Print duplicate elements in the list and how many times they present in the list?..a = [1,2,3,5,8,4,7,9,1,4,12,5,6,5,2,1,0,8,1]
Please help Ans : 1- 4 2-2 5-3 4-2 8-2
7 Answers
+ 2
Iterate through the list and make a dictionary of each element and it's count which will ensure that there are no duplicates. This hint is enough to solve the problem.
+ 2
Please Show us your attempt
+ 1
Thankyou bro đ
0
input = [1,2,3,5,8,4,7,9,1,4,12,5,6,5,2,1,0,8,1]
Dict = {}
for i in range(len(input)):
Dict[input[i]] = input.count(input[i])
Print(dict)
This is I am trying
0
You were almost there..missed one step ...
HOPE IT HELPSđ
https://code.sololearn.com/cGMRieh5xxiv/?ref=app