The following code snippet given in the end of the text @ the link given below should have mentioned fire opbject reference instead of "lines"
https://fopp.umsi.education/runestone/static/fopp/Files/FilesRecipe.html
fname = "yourfile.txt"
with open(fname, 'r') as fileref: # step 1
for lin in lines: # step 2
## some code that reference the variable lin
#some other code not relying on fileref # step 3