benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 72f1b921-8797-5328-8611-a3032c6068cf

Problem

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

complete prompt

from typing import List, Union
import numpy as np
import scipy.fft

def task_func(data: List[Union[int, str]], repetitions: int = 1):
    """
    Calculates the mode(s), their count(s), and the fast fourier transform of the data after repeating it a specified number of times.
    in a list of elements that can be repeated a specified number of times.
    
    Note:
    If the data is empty or the number of repetitions is less than or equal to 0, the function will return empty arrays.
    
    Parameters:
    - data (List[Union[int, str]]): The original list of elements (integers and/or strings).
    - repetitions (int, optional): The number of times to repeat the original list before calculating the mode. Defaults to 1.

    Requirements:
    - numpy
    - scipy
    
    Returns:
    - dict: A dictionary with two keys:
        'mode': a numpy array of the mode(s), sorted in ascending order.
        'count': a numpy array of the count(s) of the mode(s).
        
    Examples:
    >>> task_func([1, '2', '2'], repetitions=1)
    {'mode': array(['2'], dtype='<U1'), 'count': [2], 'fft': array([ 5.-0.j, -1.+0.j, -1.-0.j])}
    """

instruct prompt

Calculates the mode(s), their count(s), and the fast fourier transform of the data after repeating it a specified number of times. in a list of elements that can be repeated a specified number of times.
Note that: If the data is empty or the number of repetitions is less than or equal to 0, the function will return empty arrays.
The function should output with:
    dict: A dictionary with two keys:
    'mode': a numpy array of the mode(s), sorted in ascending order.
    'count': a numpy array of the count(s) of the mode(s).
You should write self-contained code starting with:

Code

from typing import List, Union
import numpy as np
import scipy.fft
def task_func(data: List[Union[int, str]], repetitions: int = 1):

code prompt

Code

from typing import List, Union
import numpy as np
import scipy.fft
def task_func(data: List[Union[int, str]], repetitions: int = 1):

entry point

task_func

libs

  • typing
  • numpy
  • 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