Trying to reverse it but doesnt work


#1



https://www.codecademy.com/en/courses/python-beginner-en-KAgt5/4/3?curriculum_id=4f89dab3d788890003000096#

Doesn't reverse

to reverse


garbled = "!XeXgXaXsXsXeXmX XtXeXrXcXeXsX XeXhXtX XmXaX XI"
message = ""
smthin = garbled[::-len(garbled)]
smthin = garbled[::2]
message = smthin


OUTPUT : Oops, try again. Your message doesn't look quite right; instead of "!egassem terces eht ma II!egassem terces eht ma II!egassem terces eht ma I", it should be "I am the secret message!"


#2

Both lines are on the right track. The negative sign in the first, and the 2 in the second. Now just put those two things together in one expression.

[::-2]

#3

oh for every 2 and the - represents it should go backwards? thanks


#4

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