(Apr-18-2017, 08:45 PM)snippsat Wrote:(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]
Wow! Could you please explain how that runs without exception?
>>> list(fix('xyz')) ['c', 'd', 'e']Ooops, aren't you a sneaky one?
Test everything in a Python shell (iPython, Azure Notebook, etc.)
- Someone gave you an advice you liked? Test it - maybe the advice was actually bad.
- Someone gave you an advice you think is bad? Test it before arguing - maybe it was good.
- You posted a claim that something you did not test works? Be prepared to eat your hat.