benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 8cdf0b4a-1d93-5079-84f9-0f6feac5f89d

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
from itertools import cycle

# Constants
ELEMENTS = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J']

def task_func(l):
    """
    Create a counter from a list "l" and move the first 3 elements to the end of the list.

    Parameters:
    - l (list): A list of elements that the function will process. 

    Returns:
    - counter (collections.Counter): A frequency counter that maps elements from the input list to their frequencies in the first 30 elements of the cycled, shuffled list. 
    
    Requirements:
    - collections
    - random
    - itertools

    Example:
    >>> random.seed(42)
    >>> task_func(ELEMENTS)
    Counter({'I': 3, 'F': 3, 'G': 3, 'J': 3, 'E': 3, 'A': 3, 'B': 3, 'H': 3, 'D': 3, 'C': 3})
    """

instruct prompt

Create a counter from a list "l" and move the first 3 elements to the end of the list.
The function should output with:
    counter (collections.Counter): A frequency counter that maps elements from the input list to their frequencies in the first 30 elements of the cycled, shuffled list.
You should write self-contained code starting with:

Code

from collections import Counter
import random
from itertools import cycle
# Constants
ELEMENTS = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J']
def task_func(l):

code prompt

Code

from collections import Counter
import random
from itertools import cycle
# Constants
ELEMENTS = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J']
def task_func(l):

entry point

task_func

libs

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