benchmarks.wiki / Public workspace
BigCodeBench / BigCodeBench v0.1.0_hf a29480f5-2028-5eb6-97f1-7a5ca929bac7
Problem
Answer published by the source. Consult the official source to check your work against its answer.
complete prompt
import numpy as np
import bisect
import statistics
import matplotlib.pyplot as plt
def task_func(data, value):
"""
Analyzes a list of numerical data, identifies values greater than the average,
and counts how many values are greater than a specified value. Additionally, plots the
histogram of the sorted numbers.
Parameters:
data (list): A list of numerical data.
value (float): A value to compare against the data.
Returns:
numpy.ndarray: An array of values from the data that are greater than the average.
int: The number of values in the data that are greater than the given value.
Requirements:
- numpy
- bisect
- statistics
- matplotlib.pyplot
Note:
- If the data list is empty, the function returns an empty numpy.ndarray and a count of 0. This ensures
the function's output remains consistent and predictable even with no input data.
Examples:
>>> greater_avg, count = task_func([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 5)
>>> greater_avg.tolist()
[6, 7, 8, 9, 10]
>>> count
5
"""
instruct prompt
Analyzes a list of numerical data, identifies values greater than the average, and counts how many values are greater than a specified value. Additionally, plots the histogram of the sorted numbers.
Note that: If the data list is empty, the function returns an empty numpy.ndarray and a count of 0. This ensures the function's output remains consistent and predictable even with no input data.
The function should output with:
numpy.ndarray: An array of values from the data that are greater than the average.
int: The number of values in the data that are greater than the given value.
You should write self-contained code starting with:
Code
import numpy as np
import bisect
import statistics
import matplotlib.pyplot as plt
def task_func(data, value):
code prompt
Code
import numpy as np
import bisect
import statistics
import matplotlib.pyplot as plt
def task_func(data, value):
entry point
task_func
libs
- statistics
- bisect
- numpy
- matplotlib
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
initial import