benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 09c1fdf7-651c-5467-9a18-31dc43a12295

Problem

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

complete prompt

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

def task_func(result, colors=['b', 'g', 'r', 'c', 'm', 'y', 'k']):
    """
    Draws a histogram of the "from_user" values in the provided result. The color of the histogram bars is selected at random from the provided colors list.

    Parameters:
    result (list): A list of dictionaries containing the key "from_user".
    colors (list, optional): A list of colors to choose from for the histogram bars. Defaults is ['b', 'g', 'r', 'c', 'm', 'y', 'k'].

    Returns:
    None: The function displays the histogram and does not return any value.

    Requirements:
    - random
    - matplotlib
    - seaborn

    Example:
    >>> result = [{"from_user": 0}, {"from_user": 0}, {"from_user": 1}]
    >>> task_func(result)
    """

instruct prompt

Draws a histogram of the "from_user" values in the provided result. The color of the histogram bars is selected at random from the provided colors list.
The function should output with:
    None: The function displays the histogram and does not return any value.
You should write self-contained code starting with:

Code

import random
import matplotlib.pyplot as plt
import seaborn as sns
def task_func(result, colors=['b', 'g', 'r', 'c', 'm', 'y', 'k']):

code prompt

Code

import random
import matplotlib.pyplot as plt
import seaborn as sns
def task_func(result, colors=['b', 'g', 'r', 'c', 'm', 'y', 'k']):

entry point

task_func

libs

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