I was Working on a challenge for making a cipher caesar encoder. I was fixing some errors when I came across this error I couldn't fix. Please help with this problem. Oh. and here's the code.
d = ['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']
direction = input("Type 'encode' to encrypt, type 'decode' to decrypt:\n")
text = input("Type your message:\n").lower()
shift = int(input("Type the shift number:\n"))
#TODO-1: Create a function called 'encrypt' that takes the 'text' and 'shift' as inputs.
def encrypt(text, shift):
shit = int(shift)
alphabet = d
for counter in range(0, shit):
x = len(d) - 1
y = d[x]
alphabet = alphabet.reverse()
alphabet = alphabet.remove(0)
alphabet = alphabet.insert(0, y)
print(d)
encrypt("Hello", "9")
I thought that I spelled remove() wrong. I decided to copy-paste it. I was expecting it to show me the mixed-up alphabet when I gave the shift number. What happened was that it gave me this error:
Traceback (most recent call last): File "main.py", line 17, in <module> encrypt("Hello", "9") File "main.py", line 14, in encrypt alphabet = alphabet.remove(0) AttributeError: 'NoneType' object has no attribute 'remove'