File removal from directory

I tried to remove the file from the directory in course 2, assignment week 1, but couldn’t. Though I have completed week4 earlier but stuck in week 1. Fully lost in second part of the assignment.
def split_data(SOURCE_DIR, TRAINING_DIR, VALIDATION_DIR, SPLIT_SIZE):

if len(os.listdir(SOURCE_DIR)) == 0:
os.removedirs(SOURCE_DIR)
if len(os.listdir(SOURCE_DIR)) > 0:
print(os.listdir(SOURCE_DIR))
for file in range(len(os.listdir(SOURCE_DIR))):
type(SOURCE_DIR[file])
if os.path.getsize(SOURCE_DIR[file]) == 0:
print(file, ‘is zero length, so ignoring’)
SOURCE_DIR.remove(SOURCE_DIR[file])
os.remove(SOURCE_DIR[file].path)
random.sample(os.listdir(SOURCE_DIR),len(os.listdir(SOURCE_DIR)))
print(len(os.listdir(SOURCE_DIR)))
split_data(SOURCE_DIR, TRAINING_DIR, VALIDATION_DIR, SPLIT_SIZE)

pass

I don’t follow you.
Please explain where you’re stuck.
If it helps, follow these steps to refresh your workspace