I'm a beginner in python and taking a course on it. I've been tasked with making a caesar cipher where I can input the alphabet used. For this I can't use ord()
or list()
or any imported functions, only basic python. I've got it to work for one letter but I can't seem to figure out how to make it work for more than one letter. Any help would be greatly appreciated!
def cypher(target, alphabet, shift):
for index in range( len(alphabet)):
if alphabet[index] == target:
x = index + shift
y = x % len(alphabet)
return (alphabet[y])