Hello, I'm trying to make a function that will extract letters from a text document to reveal a secret message. I'm stuck at the at the for loop. It says "list object cannot be interpreted as an integer".
They like apples.
I enjoy pears.
Time for breakfast.
Serve the oatmeal please.
Leave a tip for the waiter.
def decodefile():
fr = open("sentences.txt")
line = fr.readline()
codeKey = [[0, 1, 2, 4, 7, 14], [6], [1, 16], [7,8], [14,18]]
while (line) :
listLine = [ch for ch in line]
for x in range(0, len(listLine), codeKey):
print(codeKey)
line = fr.readline()
fr.close
decodefile()Here is the text if it matters.They like apples.
I enjoy pears.
Time for breakfast.
Serve the oatmeal please.
Leave a tip for the waiter.
