photosinensis: It's the 100x100 version of XKCD #353 (Default)
Add MemoryShare This Entry
posted by [personal profile] photosinensis at 10:40pm on 06/07/2010 under
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.
There are no comments on this entry. (Reply.)

October

SunMonTueWedThuFriSat
  1
 
2
 
3
 
4
 
5
 
6
 
7
 
8
 
9
 
10
 
11
 
12
 
13
 
14
 
15
 
16
 
17
 
18
 
19
 
20
 
21
 
22
 
23
 
24
 
25
 
26
 
27
 
28
 
29 30
 
31