benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 3147988b-5560-590f-8fee-08730460929d

Problem

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

complete prompt

import random import statistics # Constants AGE_RANGE = (22, 60) def task_func(dict1): """ Calculate the mean, the median, and the mode(s) of the age of the employees in the department "EMP$$." Generate random ages for each employee within the range [22, 60]. Parameters: dict1 (dict): A dictionary with department codes as keys and number of employees as values. Returns: tuple: A tuple of mean, median, and a list of mode(s) of employee ages. Requirements: - random - statistics Example: >>> random.seed(0) >>> d = {'EMP$$': 10, 'MAN$$': 5, 'DEV$$': 8, 'HR$$': 7} >>> stats = task_func(d) >>> print(stats) (44.7, 46.5, [46, 48, 24, 38, 54, 53, 47, 41, 52, 44]) """
Plain-text mathematical notation (without MathML)
import random
import statistics

# Constants
AGE_RANGE = (22, 60)

def task_func(dict1):
    """
    Calculate the mean, the median, and the mode(s) of the age of the employees in the department "EMP$$." 
    Generate random ages for each employee within the range [22, 60].

    Parameters:
    dict1 (dict): A dictionary with department codes as keys and number of employees 
                  as values.

    Returns:
    tuple: A tuple of mean, median, and a list of mode(s) of employee ages.

    Requirements:
    - random
    - statistics

    Example:
    >>> random.seed(0)
    >>> d = {'EMP$$': 10, 'MAN$$': 5, 'DEV$$': 8, 'HR$$': 7}
    >>> stats = task_func(d)
    >>> print(stats)
    (44.7, 46.5, [46, 48, 24, 38, 54, 53, 47, 41, 52, 44])
    """
Original LaTeX notation
import random
import statistics

# Constants
AGE_RANGE = (22, 60)

def task_func(dict1):
    """
    Calculate the mean, the median, and the mode(s) of the age of the employees in the department "EMP$$." 
    Generate random ages for each employee within the range [22, 60].

    Parameters:
    dict1 (dict): A dictionary with department codes as keys and number of employees 
                  as values.

    Returns:
    tuple: A tuple of mean, median, and a list of mode(s) of employee ages.

    Requirements:
    - random
    - statistics

    Example:
    >>> random.seed(0)
    >>> d = {'EMP$$': 10, 'MAN$$': 5, 'DEV$$': 8, 'HR$$': 7}
    >>> stats = task_func(d)
    >>> print(stats)
    (44.7, 46.5, [46, 48, 24, 38, 54, 53, 47, 41, 52, 44])
    """

instruct prompt

Calculate the mean, the median, and the mode(s) of the age of the employees in the department "EMP$$." Generate random ages for each employee within the range [22, 60].
The function should output with:
    tuple: A tuple of mean, median, and a list of mode(s) of employee ages.
You should write self-contained code starting with:

Code

import random
import statistics
# Constants
AGE_RANGE = (22, 60)
def task_func(dict1):

code prompt

Code

import random
import statistics
# Constants
AGE_RANGE = (22, 60)
def task_func(dict1):

entry point

task_func

libs

  • statistics
  • random

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