[Edu-sig] Thinking about my class...

kirby urner kirby.urner at gmail.com
Sat Mar 18 17:46:46 CET 2006


> You could go:
>
>      def makefunction():
>          theletters = uppercase[:26] + ' '
>          copyof = list(theletters)  # reason: to allow a shuffle
>          shuffle(copyof)
>          return dict(zip(theletters, copyof))

I like it.  Hadn't considered zipping a string with a list:
>>> zip('abc',['r','s','t'])
[('a', 'r'), ('b', 's'), ('c', 't')]

Kirby


More information about the Edu-sig mailing list