I have no interest in ordinary humans! (
photosinensis) wrote2010-07-06 10:40 pm
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
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:
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.
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.