
Hello, checkiomates🐱👤!
This week's Python digest offers a fascinating blend of practical insights and mind-bending challenges. We start by exploring clever ways to work with text, then dive into the subtle art of optimization and unravel the true nature of Python dictionary ordering. To test your analytical prowess, we present a complex mission: reversing the enigmatic 'Ghost Leg' game to deduce the hidden paths that transform one list into another.
💡TIP
We allow users to assign hotkeys to "Run Code", "Check Solution" and stop code. You may see current combinations on buttons and change them in editor menu. If you want to discover all CheckiO features, visit our tutorial. It's a longread, but it's worth it!
🏁 MISSION
Draw Ghost Legs by kurosawa4434 -
Ghost leg is a well-known method used to get random results. This mechanism has the effect of changing the order in the list. This mission is almost reversed the Follow Ghost Legs. You are given a list of result as input values. You have to return the list of legs that match them.
draw_ghost_legs([3, 2, 1]) == [(1, 2), (2, 3), (1, 2)] etc. draw_ghost_legs([3, 2, 4, 1]) == [(2, 3), (1, 2), (2, 3), (3, 4)] etc. draw_ghost_legs([1, 5, 4, 2, 3]) == [(3, 4), (4, 5), (3, 4), (2, 3), (3, 4)] etc.
📖 ARTICLES
The fastest way to detect a vowel in a string -
If you need to find the vowels in a string there are several different approaches you could take. This article covers 11 different ways and how each performs.
A deep dive into why real-world performance often defies Big-O expectations and why context and profiling matter more than theoretical complexity
Are Python Dictionaries Ordered Data Structures? -
Although dictionaries have maintained insertion order since Python 3.6, they aren’t strictly speaking ordered data structures. Read on to find out why and how the edge cases can be important depending on your use case.
👩💻CODE SHOT
What do you think the following code does?
from collections import Counter def stats(string: str): return Counter(string.lower().replace(' ', '')) def ?????????(first: str, second: str) -> bool: return stats(first) == stats(second)
🙌 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! ⤵