Hey guys. Just a quick question. I was wondering what the difference is between the two codes below.
Upon trying the first one, it would say that the output is "" instead of the correct answer (printing every second letter backwards).
However when I try [::-2] I got the answer. I'm confused as to why the first one didn't give me the solution (or return anything at all).
Can someone explain why the first script didn't work??
garbled = "!XeXgXaXsXsXeXmX XtXeXrXcXeXsX XeXhXtX XmXaX XI" message = garbled[0:len(garbled):-2]; print message; garbled = "!XeXgXaXsXsXeXmX XtXeXrXcXeXsX XeXhXtX XmXaX XI" message = garbled[::-2]; print message;