When you execute
The best way to do it is to make a loop like:
readgrades = gradesfile.readline()
, the value of readgrades is fixed until you change it. Therefore, it is normal that on lines 5 and 8, the result is the same. You need to execute another readline()
statement to change the value.The best way to do it is to make a loop like:
for readgrades in gradesfile: print(readgrades)If you want to assign a method to a variable, you do it this way (note the presence or absence of parenthesis):
readgrades = gradesfile.readline # without parenthesis, you assign a method print(readgrades()) # running the method (returning its value) requires parenthesis print(readgrades())