benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 9a5bacbb-0420-52b4-a0c7-19915ac80a86

Problem

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

complete prompt

import itertools
from typing import Any
from scipy import stats


def task_func(input_list: list, repetitions: int) -> Any:
    """
    Calculate the mode of a list of elements with multiple repetitions of the original list.
    
    Functionality: 
    - Takes a list and a repetition count as input.
    - Flattens the list with multiple repetitions.
    - Calculates the mode of the flattened list.
    
    Parameters:
    - input_list (list): A list containing elements (can be of any hashable type).
    - repetitions (int): The number of times the original list should be repeated.

    Requirements:
    - typing
    - itertools
    - scipy

    Returns:
    - scipy.stats.ModeResult: An object containing the mode(s) and count(s) of the most frequently occurring element(s) in the flattened list.
    
    Examples:
    >>> task_func(['A', 'B', 'C'], 10)
    ModeResult(mode=array(['A'], dtype='<U1'), count=array([10]))
    
    >>> task_func([1, 2, 3], 5)
    ModeResult(mode=array([1]), count=array([5]))
    """

instruct prompt

Calculate the mode of a list of elements with multiple repetitions of the original list. Functionality: - Takes a list and a repetition count as input. - Flattens the list with multiple repetitions. - Calculates the mode of the flattened list. >>> task_func([1, 2, 3], 5) ModeResult(mode=array([1]), count=array([5]))
The function should output with:
    scipy.stats.ModeResult: An object containing the mode(s) and count(s) of the most frequently occurring element(s) in the flattened list.
You should write self-contained code starting with:

Code

import itertools
from typing import Any
from scipy import stats
def task_func(input_list: list, repetitions: int) -> Any:

code prompt

Code

import itertools
from typing import Any
from scipy import stats
def task_func(input_list: list, repetitions: int) -> Any:

entry point

task_func

libs

  • typing
  • itertools
  • scipy

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