benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf cec27409-647e-55c8-abc4-72a46d977146

Problem

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

complete prompt

import collections
from operator import itemgetter
import matplotlib.pyplot as plt


def task_func(data):
    """
    Generate a bar plot showing the frequency of letters in the given dataset, 
    and highlight the letter associated with the maximum integer value.
    
    Parameters:
    data (list of tuples): A list where each tuple contains a letter (str) and an integer.

    Returns:
    matplotlib.axes.Axes: The Axes object of the generated plot, with the x-axis labeled 'Letter', the y-axis labeled 'Count', the title 'Letter Counts with Max Value Letter Highlighted', and the labels 'Letter Counts' and 'Max Value Letter' in the legend.
    
    Requirements:
    - collections
    - operator
    - matplotlib.pyplot

    Example:
    >>> dataset = [('a', 10), ('b', 15), ('a', 5), ('c', 20)]
    >>> ax = task_func(dataset)
    >>> type(ax)
    <class 'matplotlib.axes._axes.Axes'>
    """

instruct prompt

Generate a bar plot showing the frequency of letters in the given dataset, and highlight the letter associated with the maximum integer value.
The function should output with:
    matplotlib.axes.Axes: The Axes object of the generated plot, with the x-axis labeled 'Letter', the y-axis labeled 'Count', the title 'Letter Counts with Max Value Letter Highlighted', and the labels 'Letter Counts' and 'Max Value Letter' in the legend.
You should write self-contained code starting with:

Code

import collections
from operator import itemgetter
import matplotlib.pyplot as plt
def task_func(data):

code prompt

Code

import collections
from operator import itemgetter
import matplotlib.pyplot as plt
def task_func(data):

entry point

task_func

libs

  • operator
  • collections
  • matplotlib

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