benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 5ebdaf9f-064e-5143-9596-511d9626114f

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


def task_func(points: int):
    """
    Generate a plot of random numbers such that indices are on the x-axis and generated numbers are on the y-axis.

    Parameters:
    - points (int): Number of random points to generate.

    Returns:
    - Returns a tuple containing:
        - A list of generated random numbers.
        - A matplotlib Axes object representing the plot.

    Requirements:
    - random
    - matplotlib.pyplot

    Example:
    >>> import random
    >>> random.seed(0)
    >>> task_func(5)
    ([0.8444218515250481, 0.7579544029403025, 0.420571580830845, 0.25891675029296335, 0.5112747213686085], <Axes: >)
    >>> task_func(3)
    ([0.4049341374504143, 0.7837985890347726, 0.30331272607892745], <Axes: >)
    """

instruct prompt

Generate a plot of random numbers such that indices are on the x-axis and generated numbers are on the y-axis.
The function should output with:
    Returns a tuple containing:
    A list of generated random numbers.
    A matplotlib Axes object representing the plot.
You should write self-contained code starting with:

Code

import random
import matplotlib.pyplot as plt
def task_func(points: int):

code prompt

Code

import random
import matplotlib.pyplot as plt
def task_func(points: int):

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