how to append to a list twice?

John Salerno johnjsal at NOSPAMgmail.com
Fri Apr 21 13:54:18 EDT 2006


Edward Elliott wrote:
> John Salerno wrote:
>  > If I want to create a list of the form [100, 99, 99, 98, 98, 97, 97...]
>  > (where each item is repeated twice after the first one), how might I do
>  > that most efficiently?
> 
> Why not just this:
> 
> series = [x/2 for x in range(200, 1, -1)]

clever! :)



More information about the Python-list mailing list