benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 98843957-ed5b-53c9-8409-378114372b64

Problem

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

complete prompt

import sys
from pathlib import Path

# Constants
PATH_TO_APPEND = '/path/to/whatever'

def task_func(path_to_append=PATH_TO_APPEND):
    """
    Add a specific path to sys.path and create a directory in that path if it does not exist.

    Note:
    - The function uses a constant PATH_TO_APPEND which defaults to '/path/to/whatever'.

    Parameters:
    - path_to_append (str): The path to append to sys.path and to create a directory. Default is '/path/to/whatever'.

    Returns:
    - path_to_append (str): The path that was appended and where the directory was created.

    Requirements:
    - sys
    - pathlib
 
    Examples:
    >>> task_func("/new/path/to/append")
    "/new/path/to/append"

    >>> task_func()
    "/path/to/whatever"

    """

instruct prompt

Add a specific path to sys.path and create a directory in that path if it does not exist. >>> task_func() "/path/to/whatever"
Note that: The function uses a constant PATH_TO_APPEND which defaults to '/path/to/whatever'.
The function should output with:
    path_to_append (str): The path that was appended and where the directory was created.
You should write self-contained code starting with:

Code

import sys
from pathlib import Path
# Constants
PATH_TO_APPEND = '/path/to/whatever'
def task_func(path_to_append=PATH_TO_APPEND):

code prompt

Code

import sys
from pathlib import Path
# Constants
PATH_TO_APPEND = '/path/to/whatever'
def task_func(path_to_append=PATH_TO_APPEND):

entry point

task_func

libs

  • pathlib
  • sys

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