• Learn Using Powerful Lazy Evaluation And Try To Minimize Intersections Of Roads!

Hello, checkiomates🐱‍👤!

Welcome to this week's CheckiO Python News Digest! Get ready to dive into the fascinating world of lazy evaluation in Python. Discover how to implement this powerful concept and revolutionize your code. But that's not all! We also have an exciting challenge waiting for you: the brick factory problem. Can you crack it? Join us as we explore these intriguing topics and level up your Python skills!


You may click on any mission tag and see all missions, where this tag is present! If you want to discover all CheckiO features, visit our tutorial. It's a longread, but it's worth it!


The Brick Factory Problem by freeman_lex -

Imagine you are at the brick factory making bricks. You have a number of kilns k and a number of storages s. And you want to connect every kiln with every storage with the minimum possible number of tracks intersections. Another variant of this problem is to find the minimum number of intersections while connecting every element with all others in k sequence.

Your function must return the minimum number of intersections in the variant 1 (two arguments) or variant 2 (one argument), depending of the number of given arguments. Here is a video with wider explanation of the problems, examples, schemes and formulas 😉.

crosses(5) == 1
crosses(5, 5) == 16
crosses(7) == 9


What's Lazy Evaluation in Python? -

Being lazy is not always a bad thing. Every line of code you write has at least one expression that Python needs to evaluate. Python lazy evaluation is when Python takes the lazy option and delays working out the value returned by an expression until that value is needed.

Python needs to evaluate every expression it encounters to use its value. In this tutorial, you’ll learn about the different ways Python evaluates these expressions. You’ll understand why some expressions are evaluated immediately, while others are evaluated later in the program’s execution. So, what’s lazy evaluation in Python?


This one must be a peace of cake for you! How do you think, what the following code does?

def ???????(text: str) -> int:
    return sum(map(str.isdigit, text))

🙌 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