old_contents: # Using caesarCipher.py, encrypt the following sentences with the given keys
  # SPOILER for Chapter 7 (functions)
  
  
  def caesarCipher(key, message, mode):
  
      # Every possible symbol that can be encrypted:
      SYMBOLS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890 !?.'
  
      # Store the encrypted/decrypted form of the message:
      translated = ''
  
      for symbol in message:
          # Note: Only symbols in the SYMBOLS string can be encrypted/decrypted.
          if symbol in SYMBOLS:
              symbolIndex = SYMBOLS.find(symbol)
  
              # Perform encryption/decryption:
              if mode == 'encrypt':
                  translatedIndex = symbolIndex + key
              elif mode == 'decrypt':
                  translatedIndex = symbolIndex - key
  
              # Handle wraparound, if needed:
              if translatedIndex >= len(SYMBOLS):
                  translatedIndex -= len(SYMBOLS)
              elif translatedIndex < 0:
                  translatedIndex += len(SYMBOLS)
  
              translated += SYMBOLS[translatedIndex]
          else:
              # Append the symbol without encrypting/decrypting:
              translated += symbol
  
      return translated
  
  
  def main():
      messages = ["'You can show black is white by argument,' said Filby, 'but you will never convince me.'",
                  "1234567890", "I'm not crazy, I'm just a little unwell"]
      keys = [8, 21, 6]
  
      for index in range(len(keys)):
          print(caesarCipher(keys[index], messages[index], "encrypt"))
  
      return None
  
  
  if __name__ == "__main__":
      main()
  
new_contents: # Using caesarCipher.py, encrypt the following sentences with the given keys
  # SPOILER for Chapter 7 (functions)
  
  
  from books.CrackingCodesWithPython.Chapter01.caesarCipher import caesarCipher
  
  
  def main():
      messages = ["'You can show black is white by argument,' said Filby, 'but you will never convince me.'",
                  "1234567890", "I'm not crazy, I'm just a little unwell"]
      keys = [8, 21, 6]
  
      for index in range(len(keys)):
          print(caesarCipher(keys[index], messages[index], "encrypt"))
  
      return None
  
  
  if __name__ == "__main__":
      main()
  
subject: Update Ch. 5 Question1: changed function to module