1.This is the correct code
def game():
    return 56
c = game()
with open("PS_9-2.txt") as a: 
    b = a.read()
if(b == ""):
    with open("PS_9-2.txt","w") as a: 
        a.write(str(c))
elif(int(b) < c):
    with open("PS_9-2.txt","w") as a: 
        a.write(str(c))
2.This is the wrong one but why ?
def game():
    return 5
c = game()
with open("PS_9-2.txt") as a:
    b = a.read()
with open("PS_9-2.txt","w") as a: # is this the wrong way 
    if(b == ""):
            a.write(str(c))
    elif(int(b) < c):
            a.write(str(c))
I was expecting same output for both the code but the second code only writes when the PS_9-2.txt file is empty or the value specified in the function is greater when I provide a smaller value it just gets all clear in the text file
 
     
    