im trying to rewrite every character in a file with rot 13 and im stuck, im not sure how to go through the file and look at every character and not worry about the spaces between paragraphs
# [import statements]
import q2fun
# [constants]
# [rest of program code]
f = open("rot-13.txt", "w", encoding="utf-8")
result = q2fun.rot13(f)
def rot13(f):
f.seek(0)
# y = 0
result = ""
for char in f:
x = ord(char)
if 97 <= x < 110 or 65 <= x < 78:
# string[y]=char.replace(char, chr(x+13))
char = char.replace(char, chr(x + 13))
result = result + char
print(char)
continue
# y+=1
elif x >= 110 or 78 <= x < 91:
# string[y]=char.replace(char, chr(x-13))
char = char.replace(char, chr(x - 13))
print(char)
result = result + char
continue
# y+=1
result = result + char
return result