Nov-07-2019, 10:48 PM
(This post was last modified: Nov-07-2019, 11:52 PM by Gribouillis.)
First look at this, and take the time to understand it with the python documentation
>>> L = [1, 5, 2, 1, 2, 3, 5, 1, 5] >>> sorted(set(L)) [1, 2, 3, 5]Now replace lines 10 - 12 with
for item in sorted(set(L)): count = L.count(item) print(item + ":" + "\""+str(count)+"\"" )You can also remove L2 from the code.