benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 1619fce2-5c02-5252-97e0-d53b68a4c496

Problem

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

complete prompt

import sys
import subprocess

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

def task_func(python_version=PYTHON_VERSION, path_to_append=PATH_TO_APPEND):
    """
    Switch to a specific version of Python and add a specific path to sys.path.
    
    Note: This function changes the global Python version and should be used carefully.
    
    Parameters:
    - python_version (str): The Python version to switch to. Default is '3.8'.
    - path_to_append (str): The path to append to sys.path. Default is '/path/to/whatever'.

    Returns:
    - python_version (str): The Python version that was switched to.

    Requirements:
    - sys
    - subprocess

    Example:
    >>> task_func('3.7', '/path/to/new_directory')
    '3.7'
    """

instruct prompt

Switch to a specific version of Python and add a specific path to sys.path.
Note that: This function changes the global Python version and should be used carefully.
The function should output with:
    python_version (str): The Python version that was switched to.
You should write self-contained code starting with:

Code

import sys
import subprocess
# Constants
PYTHON_VERSION = '3.8'
PATH_TO_APPEND = '/path/to/whatever'
def task_func(python_version=PYTHON_VERSION, path_to_append=PATH_TO_APPEND):

code prompt

Code

import sys
import subprocess
# Constants
PYTHON_VERSION = '3.8'
PATH_TO_APPEND = '/path/to/whatever'
def task_func(python_version=PYTHON_VERSION, path_to_append=PATH_TO_APPEND):

entry point

task_func

libs

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