benchmarks.wiki / Public workspace
BigCodeBench / BigCodeBench v0.1.0_hf 0f465eb5-dfae-504a-8adc-d70c23b744fa
Problem
Answer published by the source. Consult the official source to check your work against its answer.
complete prompt
import random
from string import ascii_uppercase
def task_func(dict1):
"""
Assign each employee of a company a unique ID based on their department code, consisting of the department code, followed by a random string of 5 letters.
Parameters:
dict1 (dict): A dictionary with department codes as keys and number of employees
as values.
Returns:
list: A list of unique employee IDs for all departments.
Requirements:
- random
- string.ascii_uppercase
Example:
>>> random.seed(0)
>>> d = {'EMP
$$': 10, 'MAN$$': 5, 'DEV$$': 8, 'HR$$': 7}
>>> emp_ids = task_func(d)
>>> print(emp_ids)
['EMP$$MYNBI', 'EMP$$QPMZJ', 'EMP$$PLSGQ', 'EMP$$EJEYD', 'EMP$$TZIRW', 'EMP$$ZTEJD', 'EMP$$XCVKP', 'EMP$$RDLNK', 'EMP$$TUGRP', 'EMP$$OQIBZ', 'MAN$$RACXM', 'MAN$$WZVUA', 'MAN$$TPKHX', 'MAN$$KWCGS', 'MAN$$HHZEZ', 'DEV$$ROCCK', 'DEV$$QPDJR', 'DEV$$JWDRK', 'DEV$$RGZTR', 'DEV$$SJOCT', 'DEV$$ZMKSH', 'DEV$$JFGFB', 'DEV$$TVIPC', 'HR$$CVYEE', 'HR$$BCWRV', 'HR$$MWQIQ', 'HR$$ZHGVS', 'HR$$NSIOP', 'HR$$VUWZL', 'HR$$CKTDP']
"""
Plain-text mathematical notation (without MathML)
import random
from string import ascii_uppercase
def task_func(dict1):
"""
Assign each employee of a company a unique ID based on their department code, consisting of the department code, followed by a random string of 5 letters.
Parameters:
dict1 (dict): A dictionary with department codes as keys and number of employees
as values.
Returns:
list: A list of unique employee IDs for all departments.
Requirements:
- random
- string.ascii_uppercase
Example:
>>> random.seed(0)
>>> d = {'EMP$$': 10, 'MAN$$': 5, 'DEV$$': 8, 'HR$$': 7}
>>> emp_ids = task_func(d)
>>> print(emp_ids)
['EMP$$MYNBI', 'EMP$$QPMZJ', 'EMP$$PLSGQ', 'EMP$$EJEYD', 'EMP$$TZIRW', 'EMP$$ZTEJD', 'EMP$$XCVKP', 'EMP$$RDLNK', 'EMP$$TUGRP', 'EMP$$OQIBZ', 'MAN$$RACXM', 'MAN$$WZVUA', 'MAN$$TPKHX', 'MAN$$KWCGS', 'MAN$$HHZEZ', 'DEV$$ROCCK', 'DEV$$QPDJR', 'DEV$$JWDRK', 'DEV$$RGZTR', 'DEV$$SJOCT', 'DEV$$ZMKSH', 'DEV$$JFGFB', 'DEV$$TVIPC', 'HR$$CVYEE', 'HR$$BCWRV', 'HR$$MWQIQ', 'HR$$ZHGVS', 'HR$$NSIOP', 'HR$$VUWZL', 'HR$$CKTDP']
"""
Original LaTeX notation
import random
from string import ascii_uppercase
def task_func(dict1):
"""
Assign each employee of a company a unique ID based on their department code, consisting of the department code, followed by a random string of 5 letters.
Parameters:
dict1 (dict): A dictionary with department codes as keys and number of employees
as values.
Returns:
list: A list of unique employee IDs for all departments.
Requirements:
- random
- string.ascii_uppercase
Example:
>>> random.seed(0)
>>> d = {'EMP$$': 10, 'MAN$$': 5, 'DEV$$': 8, 'HR$$': 7}
>>> emp_ids = task_func(d)
>>> print(emp_ids)
['EMP$$MYNBI', 'EMP$$QPMZJ', 'EMP$$PLSGQ', 'EMP$$EJEYD', 'EMP$$TZIRW', 'EMP$$ZTEJD', 'EMP$$XCVKP', 'EMP$$RDLNK', 'EMP$$TUGRP', 'EMP$$OQIBZ', 'MAN$$RACXM', 'MAN$$WZVUA', 'MAN$$TPKHX', 'MAN$$KWCGS', 'MAN$$HHZEZ', 'DEV$$ROCCK', 'DEV$$QPDJR', 'DEV$$JWDRK', 'DEV$$RGZTR', 'DEV$$SJOCT', 'DEV$$ZMKSH', 'DEV$$JFGFB', 'DEV$$TVIPC', 'HR$$CVYEE', 'HR$$BCWRV', 'HR$$MWQIQ', 'HR$$ZHGVS', 'HR$$NSIOP', 'HR$$VUWZL', 'HR$$CKTDP']
"""
instruct prompt
Assign each employee of a company a unique ID based on their department code, consisting of the department code, followed by a random string of 5 letters.
The function should output with:
list: A list of unique employee IDs for all departments.
You should write self-contained code starting with:
Code
import random
from string import ascii_uppercase
def task_func(dict1):
code prompt
Code
import random
from string import ascii_uppercase
def task_func(dict1):
entry point
task_func
libs
- random
- string
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