I wrote a program whose goal is to preserve a numerical value with a further increase in it. However, it seems to me that there is a way to reduce or simplify my program as I plan to use it in another program.
def y(): with open(p, 'r' ,encoding="utf-8") as f: return f.read(32) def u(x): with open(p, 'w' ,encoding="utf-8") as c: x = str(x) c.write(x) def r(): with open(p, 'w' ,encoding="utf-8") as c: c.write('1') p = 'jo.txt' y() x = int(y()) print(x) a = input() if a == 'r': r() print('прогресс сброшен') else: for i in range(10): x+=1 u(x)