[Tutor] Python String Help

Alex Tenno alex.tenno at gmail.com
Mon Oct 28 21:55:37 CET 2013


Hey everyone,

I'm encountering a problem with a python function that I am supposed to
create. I want my function to look at a string, and then replace each
letter in the string with its relative position in the alphabet. for
example, 'abcde' would return '12345', 'zabd' would return '4123', and
'xpft' would return '4213'. I have been given hints that tell me "You may
want to iterate over the letters ch in s as in the for loop above, and
inside that for loop, count the number of letters that are in s and come
before the loop variable ch. You will also need an accumulator to build the
permutation the function will return." any help would be greatly
appreciated.

Many thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20131028/933158f7/attachment.html>


More information about the Tutor mailing list