Nov-10-2019, 04:58 PM
What would you change them to? The Caesar Cipher is traditionally defined only for letters, so it's not defined for numbers and symbols. Currently your code handles upper and lower case letters separately. Would you want to handle numbers and symbols as separate batches? If you would need to add sections like the
The other option would be to run it on the full ASCII table, from 32 to 126. But then you would loose the standard handling of the letters. For example, if your key was 3, 'Z' would go to ']' instead of going to 'C'.
if symbol.isalpha():
on line 32. But there is a problem with the non-alphanumeric characters. You are using ord with modular arithmetic to do the transformation, which is implicitly using ASCII. However, the non-alphanumeric characters are not all together on the ASCII table, so you would have to break them in to separate batches or doing something else to make that work.The other option would be to run it on the full ASCII table, from 32 to 126. But then you would loose the standard handling of the letters. For example, if your key was 3, 'Z' would go to ']' instead of going to 'C'.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures