benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf c18e1e08-ebde-5d6b-8565-57d887b9383f

Problem

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

complete prompt

import random
import numpy as np

def task_func(LETTERS):
    """
    Create a dictionary where keys are specified letters and values are lists of random integers.
    Then calculate the mean of these integers for each key and return a dictionary of these means.

    Parameters:
        LETTERS (list of str): List of single-character strings to be used as keys in the output dictionary.
    
    Returns:
        dict: A dictionary where each key is a letter from the input list and the value is the mean of 
              a randomly generated list of integers (with each list having 1 to 10 integers ranging from 0 to 100).
    
    Requirements:
    - random
    - np (numpy)
    
    Example:
    >>> LETTERS = ['a', 'b', 'c']
    >>> mean_dict = task_func(LETTERS)
    >>> isinstance(mean_dict, dict)
    True
    >>> 'a' in mean_dict.keys() and 'b' in mean_dict.keys() and 'c' in mean_dict.keys()
    True
    >>> all(isinstance(v, float) for v in mean_dict.values())  # Check if all values are floats
    True
    """

instruct prompt

Create a dictionary where keys are specified letters and values are lists of random integers. Then calculate the mean of these integers for each key and return a dictionary of these means.
The function should output with:
    dict: A dictionary where each key is a letter from the input list and the value is the mean of
    a randomly generated list of integers (with each list having 1 to 10 integers ranging from 0 to 100).
You should write self-contained code starting with:

Code

import random
import numpy as np
def task_func(LETTERS):

code prompt

Code

import random
import numpy as np
def task_func(LETTERS):

entry point

task_func

libs

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