F-strings, Recursion and Huffman's Algorithm
Happy New 2023 Year and Merry Christmas everyone! Haven't written you for a year!!😉 This first blog post is traditionally balanced. CheckiO team prepares for you three new missions and three links to read something interesting related programming language we all 💙💛.
get_latest("2007-03-04T21:08:12", "2007-03-04T21:08:12") == "2007-03-04T21:08:12" get_latest("2027-09-01T01:03:10", "1997-04-15T11:18:14") == "2027-09-01T01:03:10" get_latest("0001-01-01T01:01:01", "3000-11-16T13:27:02") == "3000-11-16T13:27:02"
Matrix "Hatching" by freeman_lex - You are given a 2-dimensional matrix: a list of lists of integers. Your function should return another Iterable of lists, where each inner list is a sequence of matrix elements on the same diagonal "stroke". The order of elements in the "stroke" is SW -> NE. So, building these sequences is like "hatching" the matrix!
list(hatching([])) == [] list(hatching([[1, 2], [3, 4]])) == [, [3, 2], ] list(hatching([[1, 2, 3, 4, 5], [6, 7, 8, 9, 0]])) == [, [6, 2], [7, 3], [8, 4], [9, 5], ]
Huffman Encode by CDG.Axel - Huffman code is a particular type of optimal prefix code that is commonly used for lossless data compression. In this mission you are given a simple string and your goal is to encode it with Huffman's algorithm.
huffman_encode('BADABUM') == '1001110011000111' huffman_encode('no devil lived on') == '100101111000001110010011111011010110001000111101100' huffman_encode('an assassin sins') == '110111100110001100010111110001011110'
Get your brains in shape with the following articles.
Python f-strings Are More Powerful Than You Might Think - Formatted string literals — also called f-strings — have been around since Python 3.6, so we all know what they are and how to use them. There are however some facts and handy features of f-string that you might not know about.
30 Helpful Python Snippets - This is a collections of short scripts/expressions to solve small common tasks. These tricks will prove handy in your day-to-day coding exercises at CheckiO.
Lazy Evaluation Using Recursive Python Generators - We all are familiar with Python's generators and all their benefits. But, what if I told you that we can make them even better by combining them with recursion? So, let's see how we can use them to implement "lazy recursion" and supercharge what we already do with generators in Python!
A bit of humour at the end!
🙌 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