-
Python 3.11 is here, blogger PyPI and Missions about Schedule and Working Time
Hello, checkiomates🐱👤!
This week we have a special news for you. CheckiO team upgraded Python at portal to 3.11 version🎁!
Did you know, that at your profile, after clicking on big percent number of your progress, you may see module and methods you have already used in your shared solutions. If you want to discover all CheckiO features, visit our tutorial. It's a longread, but it's worth it!
Three new missions of this week are dedicated to human resources tasks: two about schedule optimization and one about working hours calculation. We look forward to your feedback 🎉 So, here they are:
🏁 MISSIONS:
Working Hours Calculator by freeman_lex - Write a function that takes two dates and two times as input and returns the total number of working hours between the two dates (incl. both). Times representing the start and end of a workday. Working hours are defined as the time between the end and start times, Monday through Friday, excluding holidays. So the function also takes an argument that specifies a list of holidays to exclude (could be empty).
working_hours("2023-03-01", "2023-03-02", "09:00", "17:00", []) == 16 working_hours("2023-03-01", "2023-03-03", "09:00", "17:00", ["2023-03-01"]) == 16 working_hours("2023-03-01", "2023-03-05", "08:45", "17:10", ["2023-03-03"]) == 16.83
Work Schedule Generator by freeman_lex - You are given a sequence of employees with their work preferences and skills. Also you have business needs as required working time and tasks. Your function should return a schedule, that satisfies business needs with available employees (if it's possible).
schedule_generator( { "Charlie": { "pref_shifts": ["first", "second"], "days_off": ["Wednesday"], "skills": ["customer service", "inventory", "cleaning", "sales"], }, "Alice": { "pref_shifts": ["second"], "days_off": ["Saturday", "Sunday"], "skills": ["customer service", "sales"], }, "Bob": { "pref_shifts": ["first"], "days_off": ["Monday", "Tuesday"], "skills": ["customer service", "inventory"], }, }, ["Monday", 1, ["customer service", "sales"]], ) == [[], ["Alice"]]
Schedule Mode Builder by freeman_lex - You are given an unordered list of tasks. Each task is as string, which incudes a start and end of task and has a view "hh:mm-hh:mm". Tasks are unique. You function must return chronologically sorted, filtered list of tasks, which can be scheduled without overlapping. For this purpose, you are also given a mode as an integer, which tells you the rule of choosing non-overlapping tasks.
schedule( ["09:00-10:00", "09:50-10:10", "10:00-11:00", "09:00-09:20", "10:50-11:10"], 1 ) == ["09:00-09:20", "09:50-10:10", "10:50-11:10"] schedule( ["09:00-10:00", "09:50-10:10", "10:00-11:00", "09:00-09:20", "10:50-11:10"], 2 ) == ["09:00-10:00", "10:00-11:00"] schedule( ["09:00-10:00", "09:50-10:10", "10:00-11:00", "09:00-09:20", "10:50-11:10"], 3 ) == ["09:00-10:00", "10:00-11:00"]
The articles we offered you are about 3.11 new features, reduce() function power and a new blogger - PyPI!
💡ARTICLES:
Python 3.11: Cool New Features for You to Try - Python 3.11 was published on October 24, 2022. This latest version of Python is faster and more user-friendly. After seventeen months of development, it’s now ready for prime-time use. In this article, you’ll learn about new features and improvements like:
- Better error messages with more informative tracebacks
- Faster code execution due to considerable effort in the Faster CPython project
- Task and exception groups that simplify working with asynchronous code
- Several new typing features that improve Python’s static typing support
- Native TOML support for working with configuration files
The Python Package Index Launches a Blog - Python Package Index is a place for all third-party Python addons you import for your projects. The PyPI team will use this space to communicate with PyPI users, provide announcements about new features and updates, interesting technology, as well as share information and context around PyPI and related efforts of the Python Software Foundation.
Reduce - The Power of a Single Python Function - While Python is not a pure functional programming language, you still can do a lot of functional programming in it. In fact, just one function - reduce - can do most of it and in this article the author will (try) show you all the things one can do just with reduce.
A bit of humor!
🙌 Thanks for your attention! Hope to meet you at CheckiO. We are really interested in your thoughts! Please, leave a comment below! ⤵
Welcome to CheckiO - games for coders where you can improve your codings skills.
The main idea behind these games is to give you the opportunity to learn by exchanging experience with the rest of the community. Every day we are trying to find interesting solutions for you to help you become a better coder.
Join the Game