benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 3fb8a14d-5e49-5d0b-a9fa-1f0c5f298ec1

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


def task_func(n, seed=0):
    """
    Generates a simple scatter plot with 'n' points.

    Parameters:
    - n (int): The number of points to be plotted.
    - seed (int, optional): The seed for the random number generator. Defaults to None.

    Returns:
    - plot (matplotlib.figure.Figure): The generated plot titled "Scatter plot of random points", with x-axis labeled "X" and y-axis labeled "Y".
    - points (list of tuples): List containing the (x, y) coordinates of the plotted points.

    Requirements:
    - numpy
    - matplotlib.pyplot
    
    Example:
    >>> task_func(5)
    (<Figure size 640x480 with 1 Axes>, [(0.5488135039273248, 0.6458941130666561), (0.7151893663724195, 0.4375872112626925), (0.6027633760716439, 0.8917730007820798), (0.5448831829968969, 0.9636627605010293), (0.4236547993389047, 0.3834415188257777)])
    """

instruct prompt

Generates a simple scatter plot with 'n' points.
The function should output with:
    plot (matplotlib.figure.Figure): The generated plot titled "Scatter plot of random points", with x-axis labeled "X" and y-axis labeled "Y".
    points (list of tuples): List containing the (x, y) coordinates of the plotted points.
You should write self-contained code starting with:

Code

import matplotlib.pyplot as plt
import numpy as np
def task_func(n, seed=0):

code prompt

Code

import matplotlib.pyplot as plt
import numpy as np
def task_func(n, seed=0):

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