kk: >I am sure I am missing something here.< This instruction created a new dicky dict for every iteration: diky={chr(a):a}
What you want is to add items to the same dict, that you later output. The normal way to do it is: diky[chr(a)] = a Your fixed code: def values(x): diky = {} for i in xrange(x): i += 100 diky[chr(i)] = i print diky return diky b = values(5) print type(b), len(b), b['f'] print type(b), len(b), b['h'] Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list