List Slicing


garbled = "!XeXgXaXsXsXeXmX XtXeXrXcXeXsX XeXhXtX XmXaX XI"
message = garbled[::-1]
print message[::2]

I am the secret message!

Oops, try again. Your message doesn't look quite right; instead of "IX XaXmX XtXhXeX XsXeXcXrXeXtX XmXeXsXsXaXgXeX!", it should be "I am the secret message!"


the message variable should contain the correct translation. it doesn't, the output appears correct, because when you print, you apply more list slicing


so try the following

message = garbled[::-1]
message = message[::2]
print message


yea, or you just use -2, that is even easier.


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