Human: What is a good Python program to delete all files with a given extension. Assistant: 
Here is a Python program to delete all files with a given extension

import os

def _delete_files_with_extension(path, extension):
    """Delete all files with a given extension.
    """
    for root, dirs, files in os.walk(path):
        for file in files:
            if file.endswith(extension):
                os.remove(os.path.join(root, file))

# Enter the path
path = "/Users/
Rosey/Desktop/test"

# Enter the extension
extension = ".txt"

# Calling the function
print((_delete_files_with_extension(path, extension)))

#Example Output
# None

#Remember to inspect code for bugs.