• Use Combinatorics And GIL To Count Halloween Monsters!

Hello, checkiomates🐱‍👤!

Get better understanding of Python's Global Interpreter Lock (GIL), closure cases and combinatorical iterators and try to solve out holiday mission about releasing and counting monsters! Boo!)

💡TIP

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!

🏁MISSION

Count Halloween Monsters by kurosawa4434 -

For Halloween you decide to release the monsters with an old spell again. The input value is a string generated by stacking the following monster's name. Find and count the monsters in that string and returning the number.

count_halloween_monsters('jaghost') == 2
count_halloween_monsters('zombieletwitch') == 3
count_halloween_monsters('jackostmmzombiere') == 5

📖ARTICLES

Combinatoric iterators from itertools -

A short reminding article about the four iterators: product, permutations, combinations and combinations with replacements. All of these four return generators making them memory effective but they grow in size real fast so if be cautious if using them with large iterables or iterables of unknown size.

Understanding Python's Global Interpreter Lock (GIL) -

The Python Global Interpreter Lock or GIL, in simple words, is a mutex (or a lock) that allows only one thread to hold the control of the Python interpreter.
In this video course you’ll learn how the GIL affects the performance of your Python programs, and how you can mitigate the impact it might have on your code.

Python Closures: Common Use Cases and Examples Quiz -

In this quiz, you’ll test your understanding of Python closures. Closures are a common feature in functional programming languages and are particularly popular in Python because they allow you to create function-based decorators.

👩‍💻CODE SHOT

How do you think, what the following tricky code does?

def checkio(array: list[int]) -> int:
    
    return len(array) and sum(array[::2]) * array[-1]

🙌 Thanks for your attention! Hope to meet you at CheckiO, as well as at our Instagram and Twitter! 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