Hello, checkiomates🐱👤!
This week's digest explores the essence of Python, from its origins and foundational principles to mastering best practices and putting your skills to the test. We begin with a historical look at the language's development, then move on to the art of writing clear documentation through docstrings, and finally, we challenge ourselves with a koan and a mission to track inventory.
💡TIP
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!
🏁 MISSION
Slippers Selling by freeman_lex -
An indigenous community produces jute slippers and created a website to sell the production online. Slippers are of only one type, but they are produced in various sizes. The stock can be seen as a table with a single row, in which each column (1-base index) represents a size. When a slipper is sold, the stock must be updated. If the stock for a size of Slippers have zero value, slippers of this size cannot be sold. That is, the sale is not carried out. Given the initial inventory and the list of customer orders, write a program to determine How many slippers are actually sold in total. Each order refers to a single slipper. The Sales are processed sequentially, in the order in which the orders were placed. If a sale It is not possible due to lack of stock, the corresponding order is ignored.
calc_selling([1, 3, 2, 5], [3, 3, 3, 4]) == 3 calc_selling([0, 0, 0], [1, 2, 3]) == 0 calc_selling([1, 5, 5], [1, 1, 2, 2, 3, 3]) == 5
📖 ARTICLES
Python: The Documentary | An Origin Story -
“This is the story of the world’s most beloved programming language: Python. What began as a side project in Amsterdam during the 1990s became the software powering artificial intelligence, data science and some of the world’s biggest companies.”
How to Write Docstrings in Python -
Learn to write effective Python docstrings that clearly and professionally document your code using best practices and built-in conventions.
Exploring chained operations and order of evaluation in python expressions
👩💻CODE SHOT
What do you think the following code does?
from itertools import pairwise
def checkio(heights):
changePoint = False
for h1, h2 in pairwise(heights):
if changePoint and h1 < h2: return True
changePoint = h2 < h1
return False
🙌 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! ⤵