benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 3000a4c4-3123-5f59-84e6-ce1c42ed9310

Problem

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

complete prompt

import os
import shutil

def task_func(src_dir, dest_dir, extension):
    """
    Move all files with a particular extension from one directory to another.

    Parameters:
    - src_dir (str): The source directory.
    - dest_dir (str): The destination directory.
    - extension (str): The file extension.

    Returns:
    - files_moved (int): The number of files moved.

    Requirements:
    - os
    - shutil

    Example:
    >>> task_func('/path/to/src', '/path/to/dest', '.txt')
    """

instruct prompt

Move all files with a particular extension from one directory to another.
The function should output with:
    files_moved (int): The number of files moved.
You should write self-contained code starting with:

Code

import os
import shutil
def task_func(src_dir, dest_dir, extension):

code prompt

Code

import os
import shutil
def task_func(src_dir, dest_dir, extension):

entry point

task_func

libs

  • shutil
  • 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