human
Python function to check the file exists and delete it.
assistant
Here is a Python function to check the file exists and delete it

import os

def check_file_exists(fname):
    """Check if a file exists. If it does, delete it."""
    if os.path.exists(fname):
        os.remove(fname)

# Enter the file name
fname = "test.txt"

# Calling the function
print((check_file_exists(fname)))

#Example Output
# None

#Remember to inspect code for bugs.