I have a list [5, 90, 23, 12, 34, 89] etc where every two values should be a (ranked) list in the dictionary.
So the list above would become {1: [5, 90], 2: [23, 12], 3: [34, 89]} etc. I've gotten close with list comprehension but haven't cracked it. I tried:
my_list = [5, 90, 23, 12, 34, 89]
my_dict = dict((i+1, [my_list[i], my_list[i+1]]) for i in xrange(0, len(my_list)/2))
Which works for the first key, but all following values are off by one index. How would you do this?