+ 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

13th Feb 2020, 5:47 AM
Ishani
Ishani - avatar
15 Respuestas
+ 7
If order doesn't matter, this also works https://code.sololearn.com/c238ZlptsJKU/?ref=app
13th Feb 2020, 6:07 AM
Ipang
+ 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
13th Feb 2020, 6:15 AM
Gordon
Gordon - avatar
13th Feb 2020, 7:26 AM
Oma Falk
Oma Falk - avatar
+ 4
Ipang WhyFry Mirielle👽 Gordon that makes a nice collection for solutions of a common task. will keep that post in my notebook🤓
13th Feb 2020, 7:33 AM
Oma Falk
Oma Falk - avatar
+ 3
You're welcome priya krishnan , Please mark the answer that came earliest, my response was an additional example only 👍
13th Feb 2020, 6:15 AM
Ipang
+ 2
Thank u WhyFry
13th Feb 2020, 6:06 AM
Ishani
Ishani - avatar
+ 2
Thank u Ipang
13th Feb 2020, 6:10 AM
Ishani
Ishani - avatar
+ 2
Mirielle👽 I still don't quite understand how 'zip' works, but good job nonetheless ... 👍😂
13th Feb 2020, 7:37 AM
Ipang
0
Hello
14th Feb 2020, 6:56 PM
ibrohim amonov
ibrohim amonov - avatar
0
I am help you
14th Feb 2020, 6:57 PM
ibrohim amonov
ibrohim amonov - avatar
0
Hello
3rd Mar 2020, 1:19 PM
mahmoud kassem hamdy