I am workign through the Brute Caesar Cypher excercise, and cannot for the life of me seem to be able to find a way to have it show the following:
Cypher key 1:
Cypher key 2:
Which woud make the answe sooooo much better.
Here is the code I use, it works mostly, just have to work through the various soups to find the one that actually shows words, and would be nice to be able to find the right message ssociated to the right cypher key.
here is my code:
def brutecypher(message): dcod = '' # transverse the plain text for key in range(len(message)): print('\n Cypher with key: '+str(key)+'\n') for i in range(len(message)): char = message[i] if char==' ': dcod+=' ' elif char=='!': dcod+='!' # Encrypt uppercase characters in plain text elif (char.isupper()): dcod += chr((ord(char) + key - 65) % 26 + 65) # Encrypt lowercase characters in plain text else: dcod += chr((ord(char) + key - 97) % 26 + 97) return dcod brutmsg="vhfinmxkl atox kxgwxkxw tee hy maxlx hew vbiaxkl hulhexmx. px'ee atox mh kxteer lmxi ni hnk ztfx by px ptgm mh dxxi hnk fxlltzxl ltyx." print(brutecypher(brutmsg))