benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf f5a0ce17-ffaa-55f5-a94b-acca5bf2c026

Problem

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

complete prompt

import random
import seaborn as sns
import numpy as np
from matplotlib import pyplot as plt

def task_func(length, range_limit=100, seed=0):
    """
    Create a list of random numbers, sort them and record the distribution of the numbers in a histogram using 
    default settings in a deterministic seaborn plot. Return the axes object and the list of random numbers.

    Parameters:
    length (int): The length of the list of random numbers.
    range_limit (int, Optional): The range of the random numbers. Defaults to 100. Must be greater than 1.
    seed (int, Optional): The seed value for the random number generator. Defaults to 0.

    Returns:
    Tuple[matplotlib.axes._axes.Axes, List[int]]: The axes object with the plot and the list of random numbers.

    Requirements:
    - random
    - matplotlib.pyplot
    - seaborn
    - numpy

    Raises:
    ValueError: If range_limit is less than or equal to 1.

    Example:
    >>> import matplotlib.pyplot as plt
    >>> ax, data = task_func(1000, 100, 24) # Generate a list of 1000 random numbers between 1 and 100
    >>> isinstance(ax, plt.Axes)
    True
    """

instruct prompt

Create a list of random numbers, sort them and record the distribution of the numbers in a histogram using default settings in a deterministic seaborn plot. Return the axes object and the list of random numbers.
The function should raise the exception for: ValueError: If range_limit is less than or equal to 1.
The function should output with:
    Tuple[matplotlib.axes._axes.Axes, List[int]]: The axes object with the plot and the list of random numbers.
You should write self-contained code starting with:

Code

import random
import seaborn as sns
import numpy as np
from matplotlib import pyplot as plt
def task_func(length, range_limit=100, seed=0):

code prompt

Code

import random
import seaborn as sns
import numpy as np
from matplotlib import pyplot as plt
def task_func(length, range_limit=100, seed=0):

entry point

task_func

libs

  • numpy
  • matplotlib
  • random
  • seaborn

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