forked from digitalheadhunt/EstudoPython
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rot13.py
23 lines (20 loc) · 778 Bytes
/
Rot13.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
def rot13(word):
first_list = ["a","b","c","d","e","f","g","h","i","j","k","l","m","A","B","C","D","E","F","G","H","I","J","K","L","M"]
second_list = ["n","o","p","q","r","s","t","u","v","w","x","y","z","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
new_string = ""
index = 0
for ele in word:
if ele in first_list:
index = first_list.index(ele)
new_string += second_list[index]
elif ele in second_list:
index = second_list.index(ele)
new_string +=first_list[index]
elif ele not in first_list or ele not in second_list:
new_string += ele;
print(new_string)
return new_string
rot13("thalis")
rot13("fernandes")
rot13("Teste")
rot13("testA12")