
Hello, checkiomates🐱👤!
This week in Python, we explore the useful "affordances" of regular expressions, take an in-depth look at Python's enum module for creating clear symbolic constants, and test your understanding of object copying with a quiz on shallow versus deep copies. Bringing it all together, we present an intriguing mission: creating a "locator program" to distinguish a normal ship from the elusive Ghost Ship by analyzing the duration of signal pulses based on a given binary number.
💡TIP
At every mission page, under the editor window, there is a terminal window. If you want to discover all CheckiO features, visit our tutorial. It's a longread, but it's worth it!
🏁 MISSION
Ghost Detect by freeman_lex -
In the northern waters, sailors say they’ve seen Ghost Ship patrolling the waters. Nobody can see the other ships after they witness the Ghost Ship. This causes a problem: how do they distinguish a normal ship from the ghost ship in such dense fog? Try to use a locator program for this...
recognize(21) == True recognize(1587) == True recognize(3687) == False
📖 ARTICLES
A tour by Ned Batchelder of some real code showing little-used power features of the Python regular expression module, including verbose regex syntax, calling re.sub() with a function reference, and more.
This article gives an overview of the tools available in the module enum and how to use them, including Enum, auto, StrEnum, Flag, and more.
Shallow vs Deep Copying of Python Objects Quiz -
What’s the difference between a shallow copy and a deep copy of a Python object? Check if you understand how to clone arbitrary objects in Python, including your own custom classes.
👩💻CODE SHOT
What do you think the following code does?
def ???????(num): return (9, num%9)[bool(num%9)|(not num)]
🙌 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! ⤵