79744351

Date: 2025-08-23 15:07:32
Score: 2.5
Natty:
Report link

This is how you can do the Caesar cipher simply. In this code, if you enter a number greater than 26, it won’t cause any errors. For example, if you enter the word ‘Apple’ and a shift value of 123, the code will automatically wrap around the alphabet and perform the shifts correctly and the out put would be 'tiiex'.

If you run into any errors, please let me know.

try:
    word = input("Enter a word: ")
    shift = int(input("Enter the number of times that you want to shift: "))
    letters = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m",
               "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]

    cipherText = ""

    for char in word.lower():
        if char in letters:
            index = letters.index(char)
            newIndex = (index + shift) % 26
            cipherText += letters[newIndex]
        else:
            cipherText += char

    print("Encrypted word:", cipherText)
except ValueError:
    print("Please enter a valid input.")
Reasons:
  • RegEx Blacklisted phrase (2.5): please let me know
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Tej