You are viewing a single comment's thread. Return to all comments →
def caesarCipher(s, k): alphabet="abcdefghijklmnopqrstuvwxyz" new=alphabet if k<=25: new=alphabet[k:]+alphabet[0:k] else: for i in range(k): new=new[1:]+new[0:1] string="" for i in s: if ord(i)>96 and ord(i)<123: for j in range(len(alphabet)): if i==alphabet[j]: string+=new[j] else: if ord(i)>64 and ord(i)<91: for j in range(len(alphabet)): if i.lower()==alphabet[j]: string+=new[j].upper() else: string+=i return string
Seems like cookies are disabled on this browser, please enable them to open this website
Caesar Cipher
You are viewing a single comment's thread. Return to all comments →