benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf dc1bfe42-b4e7-5240-890a-33a3423b50ca

Problem

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

complete prompt

from collections import Counter
import itertools

def task_func(letters: list, repetitions: int) -> dict:
    """
    Count the frequency of each letter in a list after repeating it a given number of times.

    Parameters:
    - letters (list): A list of single-character strings representing letters.
    - repetitions (int): The number of times to repeat the list.

    Returns:
    Returns a dictionary where the keys are the letters and the values are their frequencies.

    Requirements:
    - collections.Counter
    - itertools

    Example:
    >>> task_func(['A', 'B', 'C'], 2)
    {'A': 2, 'B': 2, 'C': 2}
    >>> task_func(['A', 'B'], 3)
    {'A': 3, 'B': 3}
    """

instruct prompt

Count the frequency of each letter in a list after repeating it a given number of times.
The function should output with:
    Returns a dictionary where the keys are the letters and the values are their frequencies.
You should write self-contained code starting with:

Code

from collections import Counter
import itertools
def task_func(letters: list, repetitions: int) -> dict:

code prompt

Code

from collections import Counter
import itertools
def task_func(letters: list, repetitions: int) -> dict:

entry point

task_func

libs

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