+ 2

[SOLVED] Can you convert a list or tuple to a dictionary in python?

28th Oct 2017, 11:17 AM
Poet🎭
Poet🎭 - avatar
5 Answers
+ 12
Sure, there is a neat zip() method for that. Check it out: https://code.sololearn.com/cXUhNQb5tNW3/?ref=app
28th Oct 2017, 12:03 PM
Kuba SiekierzyƄski
Kuba SiekierzyƄski - avatar
+ 8
You can cast a list() method on it. It will return a list with the dictionary keys as elements.
28th Oct 2017, 2:55 PM
Kuba SiekierzyƄski
Kuba SiekierzyƄski - avatar
+ 2
Thanks!!!
28th Oct 2017, 1:01 PM
Poet🎭
Poet🎭 - avatar
+ 2
Then how do I turn it back to a list?
28th Oct 2017, 2:00 PM
Poet🎭
Poet🎭 - avatar
+ 2
Cool thanks, you seem to be very knowledgeable about python
28th Oct 2017, 2:57 PM
Poet🎭
Poet🎭 - avatar