+ 1
How to convert list to dict?
For example: l = [1,1,2,3,3,3,3] Need to get output, d = {"1": 2, "2":1, "3":4} Can anyone suggest
11 Antworten
+ 7
If order doesn't matter, this also works
https://code.sololearn.com/c238ZlptsJKU/?ref=app
+ 5
If you don't know Python functions, there is always a more fundamental way suitable for all languages
https://code.sololearn.com/cW04Fs3X8EJS/?ref=app
+ 5
also Counter is pythonic.
https://code.sololearn.com/cPVvRkAigm8d/?ref=app
+ 3
You're welcome priya krishnan ,
Please mark the answer that came earliest, my response was an additional example only 👍
+ 2
Thank u WhyFry
+ 2
Thank u Ipang
+ 2
Mirielle👽
I still don't quite understand how 'zip' works, but good job nonetheless ... 👍😂
0
Hello
0
I am help you
0
Hello