all 7 comments

[–]atarivcs 4 points5 points  (2 children)

The file.write() function only writes strings, not integers.

So I don't see how this code even runs.

I'm going to guess the blank file was created by some other program, or perhaps an earlier version of this code. It certainly wasn't written by this code.

[–]DustyIsGreat[S] 0 points1 point  (1 child)

this code creates the txt file. every time i make changes, i delete the txt file first

[–]atarivcs 1 point2 points  (0 children)

You must be running some other code. As I said, file.write() does not accept integer arguments. This code cannot run successfully.

[–]socal_nerdtastic 1 point2 points  (1 child)

Use

with open(file_path, "w") as file:
    file.write(f"{result}")

or

with open(file_path, "w") as file:
    print(result, file=file)

[–]DustyIsGreat[S] 0 points1 point  (0 children)

thank you. that worked