benchmarks.wiki / Public workspace
BigCodeBench / BigCodeBench v0.1.0_hf 3d789c6c-aa4c-507c-a122-9bddd695d5ed
Problem
Answer published by the source. Consult the official source to check your work against its answer.
complete prompt
import collections
import random
import json
# Constants
PREFICES = ['EMP
$$', 'MAN$$', 'DEV$$', 'HR$$']
LEVELS = ['Junior', 'Mid', 'Senior']
def task_func(department_data):
"""
Generate a JSON object from employee data based on given department codes and their employee counts.
Note:
- The keys are department codes (from the list: ['EMP$$', 'MAN$$', 'DEV$$', 'HR$$']) and the values are lists of
employee levels ('Junior', 'Mid', 'Senior') in that department.
Parameters:
department_data (dict): A dictionary with department codes as keys and number of employees as values.
Returns:
str: A JSON object representing employee levels for each department.
Requirements:
- collections
- random
- json
Example:
>>> random.seed(0)
>>> department_info = {'EMP$$': 10, 'MAN$$': 5, 'DEV$$': 8, 'HR$$': 7}
>>> level_data_json = task_func(department_info)
>>> print(level_data_json)
{"EMP$$": ["Mid", "Mid", "Junior", "Mid", "Senior", "Mid", "Mid", "Mid", "Mid", "Mid"], "MAN$$": ["Senior", "Junior", "Senior", "Junior", "Mid"], "DEV$$": ["Junior", "Junior", "Senior", "Mid", "Senior", "Senior", "Senior", "Junior"], "HR$$": ["Mid", "Junior", "Senior", "Junior", "Senior", "Mid", "Mid"]}
"""
Plain-text mathematical notation (without MathML)
import collections
import random
import json
# Constants
PREFICES = ['EMP$$', 'MAN$$', 'DEV$$', 'HR$$']
LEVELS = ['Junior', 'Mid', 'Senior']
def task_func(department_data):
"""
Generate a JSON object from employee data based on given department codes and their employee counts.
Note:
- The keys are department codes (from the list: ['EMP$$', 'MAN$$', 'DEV$$', 'HR$$']) and the values are lists of
employee levels ('Junior', 'Mid', 'Senior') in that department.
Parameters:
department_data (dict): A dictionary with department codes as keys and number of employees as values.
Returns:
str: A JSON object representing employee levels for each department.
Requirements:
- collections
- random
- json
Example:
>>> random.seed(0)
>>> department_info = {'EMP$$': 10, 'MAN$$': 5, 'DEV$$': 8, 'HR$$': 7}
>>> level_data_json = task_func(department_info)
>>> print(level_data_json)
{"EMP$$": ["Mid", "Mid", "Junior", "Mid", "Senior", "Mid", "Mid", "Mid", "Mid", "Mid"], "MAN$$": ["Senior", "Junior", "Senior", "Junior", "Mid"], "DEV$$": ["Junior", "Junior", "Senior", "Mid", "Senior", "Senior", "Senior", "Junior"], "HR$$": ["Mid", "Junior", "Senior", "Junior", "Senior", "Mid", "Mid"]}
"""
Original LaTeX notation
import collections
import random
import json
# Constants
PREFICES = ['EMP$$', 'MAN$$', 'DEV$$', 'HR$$']
LEVELS = ['Junior', 'Mid', 'Senior']
def task_func(department_data):
"""
Generate a JSON object from employee data based on given department codes and their employee counts.
Note:
- The keys are department codes (from the list: ['EMP$$', 'MAN$$', 'DEV$$', 'HR$$']) and the values are lists of
employee levels ('Junior', 'Mid', 'Senior') in that department.
Parameters:
department_data (dict): A dictionary with department codes as keys and number of employees as values.
Returns:
str: A JSON object representing employee levels for each department.
Requirements:
- collections
- random
- json
Example:
>>> random.seed(0)
>>> department_info = {'EMP$$': 10, 'MAN$$': 5, 'DEV$$': 8, 'HR$$': 7}
>>> level_data_json = task_func(department_info)
>>> print(level_data_json)
{"EMP$$": ["Mid", "Mid", "Junior", "Mid", "Senior", "Mid", "Mid", "Mid", "Mid", "Mid"], "MAN$$": ["Senior", "Junior", "Senior", "Junior", "Mid"], "DEV$$": ["Junior", "Junior", "Senior", "Mid", "Senior", "Senior", "Senior", "Junior"], "HR$$": ["Mid", "Junior", "Senior", "Junior", "Senior", "Mid", "Mid"]}
"""
instruct prompt
Generate a JSON object from employee data based on given department codes and their employee counts.
Note that: The keys are department codes (from the list: ['EMP
$$', 'MAN$$', 'DEV$$', 'HR$$']) and the values are lists of employee levels ('Junior', 'Mid', 'Senior') in that department.
The function should output with:
str: A JSON object representing employee levels for each department.
You should write self-contained code starting with:
Plain-text mathematical notation (without MathML)
Generate a JSON object from employee data based on given department codes and their employee counts.
Note that: The keys are department codes (from the list: ['EMP$$', 'MAN$$', 'DEV$$', 'HR$$']) and the values are lists of employee levels ('Junior', 'Mid', 'Senior') in that department.
The function should output with:
str: A JSON object representing employee levels for each department.
You should write self-contained code starting with:
Original LaTeX notation
Generate a JSON object from employee data based on given department codes and their employee counts.
Note that: The keys are department codes (from the list: ['EMP$$', 'MAN$$', 'DEV$$', 'HR$$']) and the values are lists of employee levels ('Junior', 'Mid', 'Senior') in that department.
The function should output with:
str: A JSON object representing employee levels for each department.
You should write self-contained code starting with:
Code
import collections
import random
import json
# Constants
PREFICES = ['EMP$$', 'MAN$$', 'DEV$$', 'HR$$']
LEVELS = ['Junior', 'Mid', 'Senior']
def task_func(department_data):
code prompt
Code
import collections
import random
import json
# Constants
PREFICES = ['EMP$$', 'MAN$$', 'DEV$$', 'HR$$']
LEVELS = ['Junior', 'Mid', 'Senior']
def task_func(department_data):
entry point
task_func
libs
- collections
- random
- json
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