List Slicing


I dont understand why it is working

It should not work

Replace this line with your code. 

garbled = "!XeXgXaXsXsXeXmX XtXeXrXcXeXsX XeXhXtX XmXaX XI"


does it not count space when we are shifting backwards?


It does consider spaces to have the same status as all the other characters. The spaces will appear in the solution where they are appropriate.


OKay now i understand..


spaces are counted, you can see this by slightly modifying the code:

garbled = "!XeXgXaXsXsXeXmX XtXeXrXcXeXsX XeXhXtX XmXaX XI"
index = len(garbled) -1
while index > 0:
    print garbled[index]
    index -= 2


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.