benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf aa08019d-469d-522b-b4fb-1fa76859d653

Problem

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

complete prompt

import random
import bisect
import statistics
import matplotlib.pyplot as plt


def task_func(n, value):
    """
    Generates 'n' random numbers between 0 and 1, finds those greater than their average,
    and counts how many are greater than or equal to a specified value, then plots 
    the sorted numbers.

    Parameters:
        n (int): The number of random numbers to generate.
        value (float): The value to compare against the random numbers.

    Returns:
        list: Numbers greater than the average of all generated numbers.
        int: The count of numbers greater than or equal to the specified value.

    Requirements:
    - random
    - bisect
    - statistics
    - matplotlib.pyplot

    Examples:
    >>> greater_avg, count = task_func(10, 0.5)
    >>> isinstance(greater_avg, list) and isinstance(count, int)
    True
    >>> len(greater_avg) <= 10
    True
    """

instruct prompt

Generates 'n' random numbers between 0 and 1, finds those greater than their average, and counts how many are greater than or equal to a specified value, then plots the sorted numbers.
The function should output with:
    list: Numbers greater than the average of all generated numbers.
    int: The count of numbers greater than or equal to the specified value.
You should write self-contained code starting with:

Code

import random
import bisect
import statistics
import matplotlib.pyplot as plt
def task_func(n, value):

code prompt

Code

import random
import bisect
import statistics
import matplotlib.pyplot as plt
def task_func(n, value):

entry point

task_func

libs

  • statistics
  • bisect
  • 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