cara menghitung pengulangan setiap string dalam daftar ular python
MyList = ["b", "a", "a", "c", "b", "a", "c", 'a']
res = {}
for i in MyList:
res[i] = MyList.count(i)
print(res)
# the output will be a dict
#{'b': 2, 'a': 4, 'c': 2}
Inquisitive Ibex