benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf d1d0c902-20fd-56ec-b537-58df44ebc6fd

Problem

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

complete prompt

import collections
import seaborn as sns
import matplotlib.pyplot as plt


def task_func(dictionary, new_key, new_value):
    """
    Add a new key-value pair to the dictionary and plot the distribution of its values.

    Parameters:
    dictionary (dict): The dictionary to be updated.
    new_key (str): The new key to be added to the dictionary.
    new_value (str): The corresponding value for the new key.

    Returns:
    dict: The updated dictionary.
    matplotlib.axes.Axes: The axes object of the plotted bar graph.

    Requirements:
    - collections
    - numpy
    - seaborn
    - matplotlib

    Example:
    >>> updated_dict, plot_axes = task_func({'key1': 'value1', 'key2': 'value2'}, 'key3', 'value3')
    >>> updated_dict
    {'key1': 'value1', 'key2': 'value2', 'key3': 'value3'}
    """

instruct prompt

Add a new key-value pair to the dictionary and plot the distribution of its values.
The function should output with:
    dict: The updated dictionary.
    matplotlib.axes.Axes: The axes object of the plotted bar graph.
You should write self-contained code starting with:

Code

import collections
import seaborn as sns
import matplotlib.pyplot as plt
def task_func(dictionary, new_key, new_value):

code prompt

Code

import collections
import seaborn as sns
import matplotlib.pyplot as plt
def task_func(dictionary, new_key, new_value):

entry point

task_func

libs

  • collections
  • matplotlib
  • seaborn

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