photosinensis: It's the 100x100 version of XKCD #353 (Default)
I have no interest in ordinary humans! ([personal profile] photosinensis) wrote2010-07-06 10:40 pm
Entry tags:

Something I felt like sharing

So I ran across this blog entry while browsing Reddit today. Now, the bank got taken by this guy. They wanted a Caesar cypher, and he gave them, well, it's an abomination.

In Python:


def caesar(string, key):
  return "".join([x if ord(x.lower()) not in range(97, 123) else chr((((ord(x.lower()) - 97) + key) % 26) + 97) for x in string])


That's in one line, and it preserves spaces and punctuation. We'll not mention his problems with command line user interfaces, which are quite powerful and awesome.