benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 2ba7a626-61e7-5fbe-a991-86944530bf64

Problem

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

complete prompt

import numpy as np
import matplotlib.pyplot as plt

# Constants
ARRAY_SIZE = 10000

def task_func():
    """
    Create a numeric array of random integers, calculate the mean and standard deviation, and draw a histogram of the distribution.

    Note:
        The random integers are generated between 1 and 100. The title of the histogram is "Histogram of Random Integers". 
        The x-axis is labeled "Value" and the y-axis is labeled "Frequency". 
        The mean is plotted as a red dashed line, and the standard deviation is plotted as purple dashed lines.
        
    Returns:
    Tuple: A tuple containing the array, mean, standard deviation, and the histogram plot (Axes).

    Requirements:
    - numpy
    - matplotlib.pyplot
    
    Example:
    >>> import numpy as np
    >>> np.random.seed(0)
    >>> array, mean, std, ax = task_func()
    >>> print(mean, std)
    49.6135 28.5323416100046
    >>> plt.show()
    """

instruct prompt

Create a numeric array of random integers, calculate the mean and standard deviation, and draw a histogram of the distribution.
Note that: The random integers are generated between 1 and 100. The title of the histogram is "Histogram of Random Integers". The x-axis is labeled "Value" and the y-axis is labeled "Frequency". The mean is plotted as a red dashed line, and the standard deviation is plotted as purple dashed lines.
The function should output with:
    Tuple: A tuple containing the array, mean, standard deviation, and the histogram plot (Axes).
You should write self-contained code starting with:

Code

import numpy as np
import matplotlib.pyplot as plt
# Constants
ARRAY_SIZE = 10000
def task_func():

code prompt

Code

import numpy as np
import matplotlib.pyplot as plt
# Constants
ARRAY_SIZE = 10000
def task_func():

entry point

task_func

libs

  • 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