Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Caeser Cypher Help
#6
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 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
Reply


Messages In This Thread
Caeser Cypher Help - by Ararisvalerian - Nov-10-2019, 12:54 AM
RE: Caeser Cypher Help - by ichabod801 - Nov-10-2019, 02:33 AM
RE: Caeser Cypher Help - by Ararisvalerian - Nov-10-2019, 11:00 AM
RE: Caeser Cypher Help - by ichabod801 - Nov-10-2019, 01:37 PM
RE: Caeser Cypher Help - by Ararisvalerian - Nov-10-2019, 04:17 PM
RE: Caeser Cypher Help - by ichabod801 - Nov-10-2019, 04:58 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  The code to decrypt Caeser Cipher. lazerwolf101 2 3,157 May-26-2020, 04:01 PM
Last Post: DT2000
  Caesar Cypher--- I don't understand why it doesn't work ironsheep 12 5,900 Nov-03-2018, 06:53 PM
Last Post: j.crater

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020