Hey everyone, I was just working through the Python course’s strings off-platform project, Coded Correspondence on Jupyter Notebook. However, I got stuck in the very first part. I wrote a caesar cipher function before in C, and I followed a similar method I did before but to no avail. I get an output I don’t expect. Can someone help me understand what it is that I am doing wrong?
Here’s my code:
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!' for index in range(len(message)): if message[index].isalpha(): asc_val = ord(message[index]) new_asc = asc_val + 10 if new_asc > ord('z'): new_asc -= 26 new_char = chr(new_asc) else: new_char = chr(new_asc) message = message.replace(message[index], new_char) print(message)