Q1. Implement python Collection Counter from Scratch.
AnswerBot
1y
Implementing Python Collection Counter from Scratch
Create an empty dictionary to store the elements and their count
Iterate through the input list and add elements to the dictionary with their count
Ret...read more
Anonymous
6mo
list1 = ['x', 'y', 'z', 'x', 'x', 'x', 'y', 'z', 'p', 'p', 'z']
d = {}
for i in list1:
if i in d:
d[i] += 1
else:
d[i] = 1
print(d)
Sovan Paul
2y
list1 = ['x','y','z','x','x','x','y', 'z','p','p','z']
d ={}
c = 0
for i in list1:
if i in d.keys():
d[i] = d[i] + 1
else:
d[i] = 1
print(d)
Add answer anonymously...
Top Tiger Analytics Senior Analyst interview questions & answers
Popular interview questions of Senior Analyst
Top HR questions asked in Tiger Analytics Senior Analyst
>
Tiger Analytics Senior Analyst Interview Questions
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app