[Tutor] How can I replicate a list in a for loop

Alan Gauld alan.gauld at btinternet.com
Wed Feb 4 14:45:52 CET 2015


On 04/02/15 13:06, Raúl Cumplido wrote:
> There is a repeat argument on the product function that is used 
> exactly for what you want to do:
> >>> for s in product(var, repeat=2)
>             print ''.join(s)
Good catch, I should have remembered that.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos



More information about the Tutor mailing list