benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf e51b1e96-dc77-5f65-abab-6b8f436be635

Problem

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

complete prompt

import matplotlib.pyplot as plt
import numpy as np
from scipy.stats import norm
from itertools import chain


def task_func(L):
    '''
    Convert a list of lists 'L' into a flattened list of integers, then fit a normal distribution to the data 
    and plot a histogram with the fitted normal distribution overlay.

    Requirements:
    - numpy
    - itertools.chain
    - scipy.stats.norm
    - matplotlib.pyplot

    Parameters:
    L (list of lists): A nested list where each inner list contains integers.

    Returns:
    matplotlib.axes._axes.Axes: Axes object with the plotted histogram and normal distribution overlay.

    Example:
    >>> ax = task_func([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
    '''

instruct prompt

Convert a list of lists 'L' into a flattened list of integers, then fit a normal distribution to the data and plot a histogram with the fitted normal distribution overlay.
The function should output with:
    matplotlib.axes._axes.Axes: Axes object with the plotted histogram and normal distribution overlay.
You should write self-contained code starting with:

Code

import matplotlib.pyplot as plt
import numpy as np
from scipy.stats import norm
from itertools import chain
def task_func(L):

code prompt

Code

import matplotlib.pyplot as plt
import numpy as np
from scipy.stats import norm
from itertools import chain
def task_func(L):

entry point

task_func

libs

  • matplotlib
  • numpy
  • itertools
  • scipy

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