benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 32244cff-1198-5530-a25a-24cdcc436710

Problem

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

complete prompt

import random
import math

def task_func(LETTERS=[chr(i) for i in range(97, 123)]):
    """
    Create a dictionary where keys are letters from a predefined list LETTERS and values are lists of random integers.
    Then, calculates the population standard deviation for each list of integers and returns a dictionary of these values.

    The random integers for each key are generated within the range 0 to 100, and each list contains between 1 to 10 integers.

    Parameters:
        LETTERS (list of str, optional): A list of single-character strings to be used as keys in the output dictionary.
                                         Defaults to the lowercase English alphabets ['a', 'b', ..., 'z'].

    Returns:
        dict: A dictionary where each key corresponds to a letter from the input list and each value is the 
              population standard deviation of a list of random integers associated with that key.

    Requirements:
    - random
    - math

    Example:
    >>> import random
    >>> random.seed(42)
    >>> sd_dict = task_func()
    >>> print(sd_dict)
    {'a': 45.5, 'b': 29.4659125092029, 'c': 25.575354649194974, 'd': 28.271717316074028, 'e': 29.118550788114437, 'f': 16.886056048968, 'g': 27.48108440364026, 'h': 32.67476090195611, 'i': 8.5, 'j': 17.5406234036238, 'k': 22.993205518152532, 'l': 2.0, 'm': 25.468935326524086, 'n': 10.23067283548187, 'o': 35.13922924736349, 'p': 26.649654437396617, 'q': 27.027763503479157, 'r': 20.316629447296748, 's': 24.997777679003566, 't': 0.0, 'u': 30.070288030250428, 'v': 21.82864622275892, 'w': 37.92308004368844, 'x': 29.899006961502092, 'y': 33.89321466016465, 'z': 21.0}
    """

instruct prompt

Create a dictionary where keys are letters from a predefined list LETTERS and values are lists of random integers. Then, calculates the population standard deviation for each list of integers and returns a dictionary of these values. The random integers for each key are generated within the range 0 to 100, and each list contains between 1 to 10 integers.
The function should output with:
    dict: A dictionary where each key corresponds to a letter from the input list and each value is the
    population standard deviation of a list of random integers associated with that key.
You should write self-contained code starting with:

Code

import random
import math
def task_func(LETTERS=[chr(i) for i in range(97, 123)]):

code prompt

Code

import random
import math
def task_func(LETTERS=[chr(i) for i in range(97, 123)]):

entry point

task_func

libs

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