What is the most elegant way to initialize a dictionary consists of chars and digits
Question: I'm looking of creating a dictionary in python which its keys are the chars
'0' to '9' , afterwards keys from 'a' to 'z', and their ids should be a
counter from 0 to 36

like this: `dict = {'0':0, '1':1, '2':2, ....., '9':9, 'a':10, .... , 'x':33,
'y':34, 'z':35}`

I manage to write this

    
    
    dict = {}
    
    for i in range(10):
        dict[str(i)] = i
    
    ord_a = ord('a')
    
    for i in range(0,26):
        dict[chr(ord_a + i)] = i+10
    

Can you help me with a better way to implement it?

And one more thing, `print(dict)` returns an unsorted object:

    
    
    {'d': 13, 'e': 14, 'f': 15, 'g': 16, 'r': 27, 'a': 10, 'b': 11, 
    'c': 12, 'l': 21, 'm': 22, 'n': 23, 'o': 24, 'h': 17, 'i': 18, 
    'j': 19, 'k': 20, '4': 4, '5': 5, '6': 6, '7': 7, '0': 0, '1': 1, 
    '2': 2, '3': 3, '8': 8, '9': 9, 'z': 35, 't': 29, 'u': 30, 
    'x': 33, 'v': 31, 'y': 34, 'w': 32, 's': 28, 'p': 25, 'q': 26}
    

Why's that? I actually initialize it quite sorted, no?


Answer: 
    import string
    keys = string.digits+string.ascii_lowercase
    values = range(len(keys))
    d = dict(zip(keys,values))
    

`dicts` have unordered keys. To have ordered keys, use a
[collections.OrderedDict](http://docs.python.org/2/library/collections.html#collections.OrderedDict).
(Also, never name a variable `dict` or `list`, etc., since this prevents you
from easily accessing the Python built-in of the same name. The built-in is
useful, as you can see above.)

