Nov-03-2019, 11:26 PM
I'm brand new to python and trying to figure out why my code isn't working. I'm trying to simulate the rot13 function, but my output only returns the first character despite being in a for loop?
def rot13(text, rotation): text = text.lower() alphabet = 'abcdefghijklmnopqrstuvwxyz' for letter in text: if letter == ' ': encrypted = ' ' else: rotated = alphabet.index(letter) + int(rotation) if rotated > 26: rotated = rotated % 26 encrypted = alphabet[rotated] return encrypted print(rot13('Hello there',13))