benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 30b7947b-f00f-5729-b9f6-f012ab3f4b8b

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

# Constants
DISTRIBUTION_SIZE = 1000

def task_func(bins=30):
    """
    Generate a Gaussian distribution and plot its histogram.

    Parameters:
    - bins (int, optional): Number of bins for the histogram. Default is 30.

    Returns:
    - tuple: A tuple containing the distribution list and the Axes patch object of the histogram plot.

    Requirements:
    - random
    - matplotlib.pyplot

    Example:
    >>> random.seed(0)
    >>> distribution, ax = task_func()
    >>> len(ax.patches) == 30
    True
    >>> len(distribution)
    1000
    >>> plt.close()
    """

instruct prompt

Generate a Gaussian distribution and plot its histogram.
The function should output with:
    tuple: A tuple containing the distribution list and the Axes patch object of the histogram plot.
You should write self-contained code starting with:

Code

import random
import matplotlib.pyplot as plt
# Constants
DISTRIBUTION_SIZE = 1000
def task_func(bins=30):

code prompt

Code

import random
import matplotlib.pyplot as plt
# Constants
DISTRIBUTION_SIZE = 1000
def task_func(bins=30):

entry point

task_func

libs

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