Skip to content

Instantly share code, notes, and snippets.

@Ikhiloya
Created November 3, 2018 09:40
Show Gist options
  • Select an option

  • Save Ikhiloya/1b408ffe0cfd65a0199ef843ad0cff5a to your computer and use it in GitHub Desktop.

Select an option

Save Ikhiloya/1b408ffe0cfd65a0199ef843ad0cff5a to your computer and use it in GitHub Desktop.
list filtering with lambda expression and slicing
garbled = "IXXX aXXmX aXXXnXoXXXXXtXhXeXXXXrX sXXXXeXcXXXrXeXt mXXeXsXXXsXaXXXXXXgXeX!XX"
message = filter(lambda x: x != 'X' , garbled)
print message
garbled = "!XeXgXaXsXsXeXmX XtXeXrXcXeXsX XeXhXtX XmXaX XI"
message = garbled[::-1][::2]
print message
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment