Convert python dictionary to python list [on hold]

Multi tool use


Convert python dictionary to python list [on hold]
dictionary = {0:0.2, 9:0.4}
pylist = [0.2, 0, 0, 0, 0, 0, 0, 0, 0, 0.4, 0]
Which is the efficient way to convert dictionary to pylist ? The keys in dictionary form the index in the list, and respective values in the dictionary become the values in list
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
Why is there a
0
at the end of the list? Before looking for an "efficient" method, do you have the problem properly scoped?– roganjosh
1 min ago
0
What happened to the
9
?– pault
1 min ago
9
BTW, the
0.4
is in the wrong place in the list if I follow your pattern. I think you want index 0
to be 0.2
and index 9
to be 0.4
– rahlf23
1 min ago
0.4
0
0.2
9
0.4
What governs the length of the resulting list?
– rahlf23
1 min ago