[Tutor] Python String Help

bob gailer bgailer at gmail.com
Tue Oct 29 20:24:23 CET 2013


On 10/28/2013 4:55 PM, Alex Tenno wrote:
> Hey everyone,
Hey back.
>
> I'm encountering a problem with a python function that I am supposed 
> to create.
What is the problem? You have not told us that!

What class is this for? I guess either the class is not the right one 
for you (over your head) or the class is just a dud, or you got behind. 
It will help us if you explain your circumstances.

Also we like to see any effort you have put into solving the problem.

What version pf Python? What Operating System? What do you use to write 
your programs? How do you run them?

> 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."


-- 
Bob Gailer
919-636-4239
Chapel Hill NC

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20131029/9b5a6b3f/attachment.html>


More information about the Tutor mailing list