Build a Caesar Cipher - Step 21

Tell us what’s happening:

solution de l’exercice 20 que j’ai fait, merci BKN

Your code so far

# User Editable Region
def caesar(text, shift):
# User Editable Region

    if not isinstance(shift, int):
        return 'Shift must be an integer value.'

    if shift < 1 or shift > 25:
        return 'Shift must be an integer between 1 and 25.'

    alphabet = 'abcdefghijklmnopqrstuvwxyz'
    shifted_alphabet = alphabet[shift:] + alphabet[:shift]
    translation_table = str.maketrans(alphabet + alphabet.upper(), shifted_alphabet + shifted_alphabet.upper())
    return text.translate(translation_table)

encrypted_text = caesar('freeCodeCamp', 3)
print(encrypted_text)

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/150.0.0.0 Safari/537.36

Challenge Information:

Build a Caesar Cipher - Step 21

GitHub Link: freeCodeCamp/curriculum/challenges/english/blocks/workshop-caesar-cipher/6819cf38880d8cc9b9f6af7a.md at main · freeCodeCamp/freeCodeCamp · GitHub

Welcome to the forum @bambakadernoutey,

It doesn’t look like you have attempted to add the default encrypt parameter as asked. Do you have a question about the example for that?

Happy coding