Level 07: string operations 0 of 9 activities solved
  1. 1. Debit card Not yet solved
  2. 2. Teacher code Not yet solved
  3. 3. Caesar cipher Not yet solved
  4. 4. Airline ticket Not yet solved
  5. 5. Disemvowel Not yet solved
  6. 6. Your move Not yet solved
  7. 7. Tweet Not yet solved
  8. 8. Valid address Not yet solved
  9. 9. Palindrome Not yet solved
Next series Level 08: files and exceptions
Level 07: string operations

3. Caesar cipher

Sign in to hand in your solution and get feedback.

# Caesar cipher program # ------------------------- # Subprograms # ------------------------- def encrypt_message(message): key = 5 encrypted_message = "" for character in message: ascii_code = ord(character) ascii_code = ascii_code + key if ascii_code > 126: ascii_code = 32 + ascii_code - 127 encrypted_message = encrypted_message + chr(ascii_code) return encrypted_message # ------------------------- # Main program # ------------------------- actual_message = input("Enter a message: ") stored_message = encrypt_message(actual_message) print("Message to send:", stored_message)