pretty dumb question but I don't know
en_alphabet = "abcdefghijklmnopqrstuvwxyz"
def is_alphabetic_char(c):
return (c.lower() in en_alphabet)
def char_to_num(c):
return en_alphabet.index(c.lower())
def num_to_char(x):
return en_alphabet[x % 26]
def CaesarEncrypt(k, plaintext):
ciphertext=""
for j in xrange(len(plaintext)):
p= plaintext[j]
if is_alphabetic_char(p):
x= (k + char_to_num(p))%26
c= num_to_char(x)
else:
c = p
ciphertext += c
return ciphertext
(but when I enter
k=16 ;plaintext = 'test.'
CaesarEncrypt(k,plaintext)
)
why does it reply me ' ' but ciphertext......