diff --git a/utilities/Caesar-Cipher/Caesar-Cipher.py b/utilities/Caesar-Cipher/Caesar-Cipher.py index bba89ccc..df43c44a 100644 --- a/utilities/Caesar-Cipher/Caesar-Cipher.py +++ b/utilities/Caesar-Cipher/Caesar-Cipher.py @@ -37,15 +37,23 @@ def main() -> None: elif choice in ["E", "ENCRYPT", "D", "DECRYPT"]: message = input("šŸ“ Enter your message: ") - + + if not message.strip(): + print("āŒ Error: Message cannot be empty.\n") + continue + + non_alpha = sum(1 for c in message if not (c.isascii() and c.isalpha())) + if non_alpha > 0: + print(f"āš ļø Warning: {non_alpha} non-alphabetic character(s) will be left unchanged.\n") + try: shift = int(input("šŸ”‘ Enter the shift key (whole number): ")) except ValueError: print("āŒ Error: Shift key must be a valid whole number.\n") continue - + result = caesar_cipher(message, shift, choice) - + print("\n✨ Resulting Message:") print(f"šŸ‘‰ {result}\n")