benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 928b828e-5919-5526-9a0f-1bd96e2df761

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
import operator

def task_func(list_of_menuitems):
    """
    Faced with a nested list of menu items, flatten the list and return the most common menu item.

    Parameters:
    - list_of_menuitems (list): A nested list of menu items.

    Returns:
    - str: The most common menu item.

    Requirements:
    - collections
    - itertools
    - operator

    Example:
    >>> task_func([['Pizza', 'Burger'], ['Pizza', 'Coke'], ['Pasta', 'Coke']])
    'Pizza'
    """

instruct prompt

Faced with a nested list of menu items, flatten the list and return the most common menu item.
The function should output with:
    str: The most common menu item.
You should write self-contained code starting with:

Code

from collections import Counter
import itertools
import operator
def task_func(list_of_menuitems):

code prompt

Code

from collections import Counter
import itertools
import operator
def task_func(list_of_menuitems):

entry point

task_func

libs

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