python challenge question (string manipulation)
John Salerno
johnjsal at NOSPAMgmail.com
Wed Mar 29 15:41:09 EST 2006
Caleb Hattingh wrote:
> Also, I suspect you meant to say:
>
>>>> alphabet = string.ascii_lowercase
>>>> code = alphabet[2:] + alphabet[:2]
Ah yes, I see what you did there. :)
> I actually create a new list here, although since lists are mutable, I
> could probably just change items in-place. There is very likely
> something already in the builtins or the standard library for this, but
> I just haven't searched hard enough.
I'm pretty sure I read about a method for moving the items in lists
around like that, so that you can shift the beginning to the end and
vice versa. If I can find it, I'll let you know.
More information about the Python-list
mailing list