Apr-18-2017, 08:45 PM
(Apr-18-2017, 07:14 PM)volcano63 Wrote: here is the proper way to do it (I hope it is not homework)Okay way,he will get full score if teacher is not full out Pythonic
Look like a typicality homework task.
So when we are in solution modus.
from string import ascii_lowercase def fix(word, char_offset=2): char = ascii_lowercase for index,item in enumerate(word, char_offset): yield char[index]Test:
>>> s = 'abcde' >>> ''.join(fix(s)) 'cdefg' >>> list(fix(s)) ['c', 'd', 'e', 'f', 'g']