[Tutor] ideas?
Alan Gauld
alan.gauld at btinternet.com
Mon Nov 18 12:01:08 CET 2013
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
More information about the Tutor
mailing list