R. Alan Monroe wrote:

> def checksolution(sol):
>     maybes = []
>     big = ''.join(solution)
>     for x in range(len(sol)):
>         maybes.append( big[x::6] )
>     print maybes
> 
> solution=['abject','poetry','keypad']
> checksolution(solution)
> 
> ['apk', 'boe', 'jey']

That's nice. Why do you use len(sol) instead of len(sol[0])? You only 
print the first three items. Here is another way to do it:

In [8]: solution=['abject','poetry','keypad']
In [9]: [''.join(x) for x in zip(*solution)]
Out[9]: ['apk', 'boe', 'jey', 'etp', 'cra', 'tyd']

Kent
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to