Can anyone tell me how to arrange those numbers in last part in dict d in descending order of appearances ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Can anyone tell me how to arrange those numbers in last part in dict d in descending order of appearances ?

https://code.sololearn.com/c99JBrCRV3JG/?ref=app

6th Dec 2019, 9:44 PM
Abhay
Abhay - avatar
2 Answers
+ 5
Exchange line 35 with this: for i, j in sorted( d.items(), key=lambda x: x[1], reverse=True ):
6th Dec 2019, 10:02 PM
HonFu
HonFu - avatar
+ 2
HonFu ty :-)
6th Dec 2019, 10:05 PM
Abhay
Abhay - avatar