benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf e918d1a5-0f76-590a-8264-0b531a441934

Problem

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

complete prompt

from collections import Counter
import random

LETTERS = ['a', 'b', 'c', 'd', 'e']

def task_func(count, seed=0):
    """
    Generate a specific number of random letter pairs, each from a predefined list, and analyze the frequency of each pair.

    Parameters:
    - count (int): The number of letter pairs to generate.
    - seed (int, optional): Seed for the random number generator to ensure reproducibility. Defaults to None.

    Returns:
    - Counter: A Counter object representing the frequency of each generated letter pair.

    Requirements:
    - collections.Counter
    - random

    Examples:
    >>> task_func(5, seed=42)
    Counter({('d', 'a'): 1, ('b', 'b'): 1, ('d', 'd'): 1, ('e', 'a'): 1, ('c', 'a'): 1})
    >>> task_func(0, seed=42)
    Counter()
    """

instruct prompt

Generate a specific number of random letter pairs, each from a predefined list, and analyze the frequency of each pair.
The function should output with:
    Counter: A Counter object representing the frequency of each generated letter pair.
You should write self-contained code starting with:

Code

from collections import Counter
import random
LETTERS = ['a', 'b', 'c', 'd', 'e']
def task_func(count, seed=0):

code prompt

Code

from collections import Counter
import random
LETTERS = ['a', 'b', 'c', 'd', 'e']
def task_func(count, seed=0):

entry point

task_func

libs

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