This is the first time i'm asking problems as i'm a noob in programming.
I'm trying to complete problems from Codewars,
"ROT13 is a simple letter substitution cipher that replaces a letter with the letter 13 letters after it in the alphabet. ROT13 is an example of the Caesar cipher.
Create a function that takes a string and returns the string ciphered with Rot13. If there are numbers or special characters included in the string, they should be returned as they are. Only letters from the latin/english alphabet should be shifted, like in the original Rot13 "implementation"."
I've tried to code it at my best abilities, and it come up like this.
def rot13(message):
v = []
for i in message:
if i.isupper()== True:
d = ord(i) + 13
e = chr(d)
if d > 90:
u = (d - 91)
o = chr(u+65)
v.append(o)
else:
v.append(e)
elif i.islower() == True:
x = (ord(i)+13)
y = chr(x)
if x > 122:
z = (x - 123)
p = chr(z+97)
v.append(p)
else:
v.append(y)
else:
v.append(i)
print(''.join(v))
It worked (seemingly), but it says that it's not correct. Where does it wrong ? I know it's ugly, but well. Thank you in advance.