We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
input = 'aabbbccde'
from collections import Counter
c=Counter(input)
k = c.most_common(3)
print((a,b) for (a,b) in k)
I am getting this output
Anyone please explain
<generator object <genexpr> at 0x000002884DEF6318>
Also why did u use sorted function here
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Company Logo
You are viewing a single comment's thread. Return to all comments →