benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 2da67224-cd6a-5bb5-b126-ab63597b4976

Problem

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

complete prompt

import numpy as np
from collections import Counter
import matplotlib.pyplot as plt

def task_func(L):
    """
    Analyze an "L" list by calculating the mean, median, mode, and standard deviation.
    Visualize the data by returning a histogram plot.
    
    Parameters:
    L (list): Input list.
    
    Returns:
    dict: A dictionary with the 'mean', 'median', 'mode', 'std_dev' of 'L, and the 'plot' Axes object.
    
    Requirements:
    - numpy
    - collections.Counter
    - matplotlib.pyplot
    
    Example:
    >>> L = [1, 2, 3, 4, 5, 6, 7, 8, 9]
    >>> stats = task_func(L)
    >>> print(stats["mean"])
    5.0
    >>> print(stats["median"])
    5.0
    >>> print(stats["mode"])
    1
    """

instruct prompt

Analyze an "L" list by calculating the mean, median, mode, and standard deviation. Visualize the data by returning a histogram plot.
The function should output with:
    dict: A dictionary with the 'mean', 'median', 'mode', 'std_dev' of 'L, and the 'plot' Axes object.
You should write self-contained code starting with:

Code

import numpy as np
from collections import Counter
import matplotlib.pyplot as plt
def task_func(L):

code prompt

Code

import numpy as np
from collections import Counter
import matplotlib.pyplot as plt
def task_func(L):

entry point

task_func

libs

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