benchmarks.wiki / Public workspace
BigCodeBench / BigCodeBench v0.1.0_hf 7b46bbad-0326-5cb1-9280-93980e53fa7a
Problem
Answer published by the source. Consult the official source to check your work against its answer.
complete prompt
import numpy as np
import matplotlib.pyplot as plt
# Constants
BAR_COLOR = ['blue', 'green', 'red', 'cyan', 'magenta', 'yellow', 'black']
def task_func(data_size):
"""
Generates random numeric data and creates a histogram of the data.
The color of the histogram bars is randomly selected from a predefined list.
Parameters:
data_size (int): The number of data points to generate.
Returns:
tuple:
- ndarray: The array of randomly generated data.
- str: The color used for the histogram bars.
Requirements:
- numpy
- matplotlib
Example:
>>> data, color = task_func(5)
>>> print(data.shape)
(5,)
>>> print(color in ['blue', 'green', 'red', 'cyan', 'magenta', 'yellow', 'black'])
True
"""
instruct prompt
Generates random numeric data and creates a histogram of the data. The color of the histogram bars is randomly selected from a predefined list.
The function should output with:
tuple:
ndarray: The array of randomly generated data.
str: The color used for the histogram bars.
You should write self-contained code starting with:
Code
import numpy as np
import matplotlib.pyplot as plt
# Constants
BAR_COLOR = ['blue', 'green', 'red', 'cyan', 'magenta', 'yellow', 'black']
def task_func(data_size):
code prompt
Code
import numpy as np
import matplotlib.pyplot as plt
# Constants
BAR_COLOR = ['blue', 'green', 'red', 'cyan', 'magenta', 'yellow', 'black']
def task_func(data_size):
entry point
task_func
libs
- 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