Work Schedule Generator

Work Schedule Generator

Moderate+

example

您会得到一系列员工的工作偏好和技能。此外,您还需要满足工作时间和任务方面的业务需求。您的功能应该返回一个时间表,以满足业务需求和可用员工(如果可能的话)。现在,让我们深入了解一下细节。

staff 是一个 字典 ,其中键是员工姓名,值也是 字典 。每个值字典 包括三个键值对:

  • "pref_shifts" -字符串列表 :班次,员工希望在哪个班次工作(可以是"first""second" 或两个都是,按此顺序排列);
  • "days_off" -列出 的字符串:员工希望休息的日子(工作日的全称);
  • "skills" -列出 的字符串:工作,员工可从事的工作。

business_needs 是一个 列表 ,包含三个值:工作日--字符串;这一天的班次数--整数;这一天应完成的任务--列表 ,包含字符串。

关于轮班的注意事项。每个员工可以在第一班、第二班或两班(全天)工作,不包括休息日。业务班次数是指这一天不同班次的数量。例如,如果班次数为3 ,则可由一名全天工作的员工(他的两个班次,"一班 "和 "二班",总计 - 2)和更多的员工(因为每个员工至少有一个班次),或由不同员工的三个班次组成。班次数应平均分配给"first""second" 日班。如果班次数为奇数(且不等于 1),"first" 日班必须比"second" 日班多一个班次。

不同员工的技能可能部分/完全相同。因此,在填补日班空缺时,应选择技能数量较少的员工--他们的薪酬通常较低。如果数量相同,则按姓名字母顺序选择。从员工参与的角度来看,第一天的班次具有优先权:让技能较少的员工在那里工作更重要。任务是必须完成的最低顺序--这一天的综合技能顺序可以更宽。每项任务都必须由"first""second" 日班的员工完成(包含相应的技能)。

您的函数应返回一个 两个列表 (日班)组成,其中包含按字母顺序排列的员工姓名,这些员工将在各自的日班工作。如果班次数为1 - 则其中一个内部列表 将为空。如果无法制定时间表,则两个内部列表 都应为空。

输入:两个参数:一个包含雇员数据的字典 ,一个 包含业务需求描述的列表 。

输出:两个数组 两个列表 的列表,名称为字符串。

示例

assert schedule_generator(
    {
        "Charlie": {
            "pref_shifts": ["first", "second"],
            "days_off": ["Wednesday"],
            "skills": ["customer service", "inventory",...
You should be an authorized user in order to see the full description and start solving this mission.
Settings
Code:
Other:
Invalid hot key. Each hot key should be unique and valid
Hot keys:
CheckiO Extensions

CheckiO Extensions allow you to use local files to solve missions. More info in a blog post.

In order to install CheckiO client you'll need installed Python (version at least 3.8)

Install CheckiO Client first:

pip3 install checkio_client

Configure your tool

checkio --domain=py config --key=

Sync solutions into your local folder

checkio sync

(in beta testing) Launch local server so your browser can use it and sync solution between local file end extension on the fly. (doesn't work for safari)

checkio serv -d

Alternatevly, you can install Chrome extension or FF addon

checkio install-plugin
checkio install-plugin --ff
checkio install-plugin --chromium

Read more here about other functionality that the checkio client provides. Feel free to submit an issue in case of any difficulties.

Pair Programming (Beta-version)

Welcome to Pair Programming! Engage in real-time collaboration on coding projects by starting a session and sharing the provided unique URL with friends or colleagues. This feature is perfect for joint project development, debugging, or learning new skills together. Simply click 'Start Session' to begin your collaborative coding journey!

Waiting for Pair Programming to start...

You are trying to join a pair programming session that has not started yet.

Please wait for the session creator to join.

Waiting for Pair Programming to reconnect...

It looks like the creator of the pair programming session closed the editor window.

It might happen accidentally, so that you can wait for reconnection.

×
 
 
<< <
> >>
exec show

Whats Next?

Free accounts will see Best CheckiO solutions with some delay.
Best Solutions will be opened in a moment
Become Awesome and Don't wait
The next stage is ""
Will be activated in
View More Solutions Random Review Solutions Go to the next mission