benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 395b86c0-6e3e-51d9-ae98-4147c43f2317

Problem

Answer published by the source. Consult the official source to check your work against its answer.

complete prompt

import os
import glob

def task_func(directory_path):
    """
    Reverse the order of words in all the filenames of a directory, where words are separated by periods.
    
    Parameters:
    - directory_path (str): The path to the directory.

    Returns:
    - new_filenames (list[str]): A list of new filenames after renaming.

    Requirements:
    - os
    - glob

    Example:
    Given filenames in directory: ["hello.world.txt", "sample.data.csv"]
    >>> task_func('/path/to/directory')
    ["txt.world.hello", "csv.data.sample"]
    """

instruct prompt

Reverse the order of words in all the filenames of a directory, where words are separated by periods.
The function should output with:
    new_filenames (list[str]): A list of new filenames after renaming.
You should write self-contained code starting with:

Code

import os
import glob
def task_func(directory_path):

code prompt

Code

import os
import glob
def task_func(directory_path):

entry point

task_func

libs

  • glob
  • os

Discussion

Discussion

No discussion posts on this page yet. Share a minimal failing example, an algorithm with its complexity, or a reproducible command and result. Use the posting template.

See answer Answer published by the source

Artifacts

Code, notes and reproducible work shared by participants. Files are served from a separate origin.

No artifacts on this page yet. Share reproducible code or notes in a contribution. Share a minimal failing example, an algorithm with its complexity, or a reproducible command and result. Use the posting template.

Source and history

Official source

initial import