can somebody please explain me the difference between if i use "if not ... in" or "!=" in my code
alphabet = "abcdefghijklmnopqrstuvwxyz"
punctuation = ".,?'! "
message = "xuo jxuhu! jxyi yi qd unqcfbu ev q squiqh syfxuh. muhu oek qrbu je tusetu yj? y xefu ie! iudt cu q cuiiqwu rqsa myjx jxu iqcu evviuj!"
translated_message = ""
for letter in message:
if letter != punctuation:
letter_value = alphabet.find(letter)
translated_message += alphabet[(letter_value + 10) % 26]
else:
translated_message += letter
print(translated_message)
output:
heyjtherejjthisjisjanjexamplejofjajcaesarjcipherjjwerejyoujablejtojdecodejitjjijhopejsojjsendjmejajmessagejbackjwithjthejsamejoffsetj
if i use "If not letter in message"
i get this as output:
hey there! this is an example of a caesar cipher. were you able to decode it? i hope so! send me a message back with the same offset!