benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 2c23c66e-209b-58a7-9fb2-c5902ffb9e83

Problem

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

complete prompt

import random
import matplotlib.pyplot as plt

# Constants
SALARY_RANGE = (20000, 100000)

def task_func(dict1):
    """
    Analyze the salary distribution within the department with code 'EMPXX'. Generate random salaries for each employee and create a histogram.
    - For the department of interest, randomly generate as many salaries as its number of employees.
    - Make sure that the salary is within SALARY_RANGE.
    - The histogram title should be 'Salary Distribution in EMPXX Department'
    - The x-label should be set to 'Salary'
    - The y-label should be set to 'Number of Employees'

    Parameters:
    - dict1 (dict): A dictionary with department codes as keys and number of employees as values.

    Returns:
    - matplotlib.axes._axes.Axes: Axes object representing the histogram.

    Requirements:
    - random
    - matplotlib.pyplot

    Example:
    >>> d = {'EMPXX': 10, 'MANXX': 5, 'DEVXX': 8, 'HRXX': 7}
    >>> ax = task_func(d)
    >>> print(ax)
    Axes(0.125,0.11;0.775x0.77)
    """

instruct prompt

Analyze the salary distribution within the department with code 'EMPXX'. Generate random salaries for each employee and create a histogram. - For the department of interest, randomly generate as many salaries as its number of employees. - Make sure that the salary is within SALARY_RANGE. - The histogram title should be 'Salary Distribution in EMPXX Department' - The x-label should be set to 'Salary' - The y-label should be set to 'Number of Employees'
The function should output with:
    matplotlib.axes._axes.Axes: Axes object representing the histogram.
You should write self-contained code starting with:

Code

import random
import matplotlib.pyplot as plt
# Constants
SALARY_RANGE = (20000, 100000)
def task_func(dict1):

code prompt

Code

import random
import matplotlib.pyplot as plt
# Constants
SALARY_RANGE = (20000, 100000)
def task_func(dict1):

entry point

task_func

libs

  • 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