[Tutor] ideas?

Danny Yoo dyoo at hashcollision.org
Mon Nov 18 18:59:39 CET 2013


For reference, here are the documentation pages for ord() and chr():

    http://docs.python.org/3/library/functions.html?highlight=chr#ord

    http://docs.python.org/3/library/functions.html?highlight=chr#chr


On Mon, Nov 18, 2013 at 3:01 AM, Alan Gauld <alan.gauld at btinternet.com>wrote:

> On 18/11/13 03:27, Byron Ruffin wrote:
>
>> Need a little help with finding a process for this:
>>
>> when a string of text is input, for example: abc def.
>> I want to have each letter shift to the right one place in the alphabet.
>> Thus..
>> abc def would be output as bcd efg.
>>
>> Any ideas on how to do this?
>>
>
> Yes, use the ord() function to convert the letters to numbers. Add one and
> convert back using the chr() function. Check for the special case of 'z'.
>
> Consider how to handle upper case letters too.
>
> hth
> --
> Alan G
> Author of the Learn to Program web site
> http://www.alan-g.me.uk/
> http://www.flickr.com/photos/alangauldphotos
>
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20131118/0471d14c/attachment.html>


More information about the Tutor mailing list