Tell us what’s happening:
Stuck on Step 22. Checker keeps saying ‘You should set shift to - shift when encrypt is not truthy’ no matter what I try. I’ve tried if not encrypt, if encrypt != True, if encrypt is False, shift = -shift, shift = - shift, shift *= -1, moving the block around, resetting, and different browsers. Code runs fine, logic is correct. Seems like a checker bug — others have reported the same. Any workaround?
Your code so far
# User Editable Region
def caesar(text, shift, encrypt=True):
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.'
if not encrypt:
shift = - shift
alphabet = 'abcdefghijklmnopqrstuvwxyz'
# User Editable Region
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36
Challenge Information:
Build a Caesar Cipher - Step 22