• Python 3.12 At CheckiO! Try It While Solving New and Time-proven Missions

Hello, checkiomates🐱‍👤!

🚀Exciting news! We've just launched our brand-new Instagram page! 🎉 Follow us @playcheckio for exclusive updates, join the journey and be part of our community! 🌟

At this news we wrote about Python 3.12 release, its new features and optimizations. And now we proudly inform you, that CheckiO team have upgraded Python at portal to this 3.12 version and you may try its new features while solving our missions!

Did you know, that on Easy difficulty, each of the few starting stations is dedicated to a distinct data type. If you want to discover all CheckiO features, visit our tutorial. It's a longread, but it's worth it!

🏁 MISSIONS:

For your attention there are two missions with opposite goal - to convert matrix of integers into a string by some rules and to convert back! The third mission in today's news continues a series about mahjong, which we started earlier.

Matrix-2-String by freeman_lex - You are given a 5x5 matrix of integers as tuple of tuples. Use it as a mask for the square-arranged letters of the alphabet from "a" to "y" (row-major order). Return a string of characters (sorted, ignore case), picked from the square of letters according to the mask with the following rule: 0 in mask - do not take the respective character; 1 - take in lowercase; 2 - take in uppercase.

converter((
            (0, 0, 1, 0, 0),
            (0, 1, 0, 1, 0),
            (1, 0, 2, 0, 1),
            (0, 1, 0, 1, 0),
            (0, 0, 1, 0, 0),
        )) == "cgikMoqsw"

String-2-Matrix by freeman_lex - You are given an unsorted string of unique (ignoring case) lower- and/or uppercase letters. Represent it as a correct mask for the square-arranged letters of the alphabet from "a" to "y" (row-major order). The mask must be a 5x5 matrix of integers as tuple of tuples with the following rule. character is not present in the string - use 0 in mask; character is lowercase - use 1; character is uppercase - use 2.

converter("sMcigkqow") == (
    (0, 0, 1, 0, 0),
    (0, 1, 0, 1, 0),
    (1, 0, 2, 0, 1),
    (0, 1, 0, 1, 0),
    (0, 0, 1, 0, 0))

R-mahjong ⅠⅠ: is hand winning? by gleb10101010101 - The second part of the series dedicated to the Japanese game "riichi mahjong". It's a little more complicated than the previous one.

Your task is to check if the hand is a winning one. If in the previous mission you were given a ready-made hand, then in this one there will be just a set of tiles in the input data, which may not be victorious.

In this mission, the second argument of the function is added — a list of so-called open sets. Each of the open sets needs to be checked whether it is valid or not.

riichi_mahjong_win_hand(['m1', 'm2', 'm3', 'm5', 'm5', 'p2', 'p3', 'p4', 'p7', 'p8', 'p9'], ['s456']) == True

💡ARTICLES:

Today's articles are about textwrap module features, tools for string interpolation and usage of splat operator.

Everything You Can Do with Python's textwrap Module - Python has many options for formatting strings and text, including f-strings, format() function, templates and more. There's however one module that few people know about and it's called textwrap.

This module is specifically built to help you with line-wrapping, indentation, trimming and more, and in this article we will look at all the things you can use it for.

Python's Format Mini-Language for Tidy Strings - When you’re doing string interpolation in your Python code, you often need to format the interpolated values to meet some formatting requirements. To do this, Python provides what is known as the format mini-language, which defines the syntax of a format specifier.

Perhaps you’re comfortable working with strings, but you want to take even more control of them. With proficiency in the format mini-language, you’ll be able to use format specifiers to do things like formatting numbers as currency values, using scientific notation, expressing a value as a percentage, and so much more.

The splat operator, or *args and **kwargs in Python - The * operator has many usages in Python. Multiplication and power are the most common, but today we are going to see how it's used as the "splat" operator. If you come from JS, you know this as spread. It's those mysterious *args and **kwargs you see once in a while. Let's find out, what the let you do.

What methods of code debugging do you use?!

🙌 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