benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf bdab342b-3ddb-5a32-8ebb-16d45f733a9f

Problem

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

complete prompt

import itertools
import statistics


# Refined function after importing required libraries
def task_func(elements, subset_size):
    """
    Generate all subsets of a given size from a tuple and calculate the mean, median, and mode of the sums of the subsets.

    Args:
    - elements (tuple): A tuple of numbers from which subsets will be generated.
    - subset_size (int): The size of the subsets to be generated.

    Returns:
    dict: A dictionary with the mean, median, and mode of the sums of the subsets.

    Requirements:
    - itertools
    - statistics
    
    Example:
    >>> task_func((1, 2, 3, 4, 5, 6, 7, 8, 9, 10), 2)
    {'mean': 11, 'median': 11, 'mode': 11}
    """

instruct prompt

Generate all subsets of a given size from a tuple and calculate the mean, median, and mode of the sums of the subsets. Args: - elements (tuple): A tuple of numbers from which subsets will be generated. - subset_size (int): The size of the subsets to be generated.
The function should output with:
    dict: A dictionary with the mean, median, and mode of the sums of the subsets.
You should write self-contained code starting with:

Code

import itertools
import statistics
# Refined function after importing required libraries
def task_func(elements, subset_size):

code prompt

Code

import itertools
import statistics
# Refined function after importing required libraries
def task_func(elements, subset_size):

entry point

task_func

libs

  • statistics
  • itertools

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