Learn About Lambdas, Type Hints And Data Science Survey While Solving New Missions
Did you know, that 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!
In the following missions you need to find the best place for magic string "CheckIO" inside another string, sort integer in a very tricky way and efficiently count number of intersections.
Tricky String by Kolia951 - You are given a string. Somewhere in that text a word "CheckIO" has hidden. Your task is to find a place where word is hiding and make the minimum number of replacements to get it. Let's proceed with an example: for a string "xheckIO" you should replace only one symbol ("x" to "C") to get a desired word, on the other hand we can try to find it in more complex string: "CheckzzVSCheckIz", right answer here will be a string "CheckzzVSCheckIO" (only one replacemend has made "z" to "O").
Every string contains at least one of seven characters of the word "CheckIO" and there are enough symbols around it to obtain the necessary word. If there are several ways to complete the task, just put the word in the first suitable place for that.
tricky_string("checkIO") == "CheckIO" tricky_string("zcheckzz") == "zCheckIO" tricky_string("SoManyChoicesHere") == "SoManyCheckIOHere"
Ordinary Cardinals by freeman_lex - Sorting can be performed meaningfully according to arbitrary comparison criteria, as long as those criteria satisfy the mathematical requirements of a total ordering relation. To play around with this concept to grok it, let us define a wacky ordering relation of positive integers so that for any two integers, the one that contains the digit 9 more times is considered to be larger, regardless of the magnitude and other digits of these numbers.
For example, 99 > 123456789 > 1010 in this ordering. If both integers contain the digit 9 the same number of times, the comparison proceeds to the next lower digit 8, and so on down there until the first distinguishing digit has been discovered. If both integers contain every digit from 9 to 0 pairwise the same number of times, the ordinary integer order comparison determines their mutual ordering.
Your goal is to sort given sequence of integers according to this rule in ascending order.
sort_digit_count([9876, 19, 4321, 99, 73, 241, 111111, 563, 33]) == [111111, 33, 241, 4321, 563, 73, 19, 9876, 99] sort_digit_count([1234, 4321, 3214, 2413]) == [1234, 2413, 3214, 4321] sort_digit_count([111, 19, 919, 1199, 911, 999]) == [111, 19, 911, 919, 1199, 999]
Overlapping Disks by freeman_lex - Given a list of disks on the two-dimensional plane represented as tuples (x, y, r) so that x, y is the center point and r is the radius of that disk, count how many pairs of disks intersect.
Two disks (x1, y1, r1) and (x2, y2, r2) intersect if and only if they satisfy the Pythagorean inequality (x2-x1)**2+(y2-y1)**2<=(r1+r2)**2.
For this problem, crudely looping through all possible pairs of disks would work, but also become horrendously inefficient for large lists. However, a sweep line algorithm can solve this problem not just effectively, but also efficiently (a crucial but often overlooked “eff-ing” distinction) by looking at a far fewer pairs of disks.
overlapping_disks([(4, -1, 3), (-3, 3, 2), (-3, 4, 2), (3, 1, 4)]) == 2 overlapping_disks([(-10, 6, 2), (6, -4, 5), (6, 3, 5), (-9, -8, 1), (1, -5, 3)]) == 2 overlapping_disks([(0, 0, 3), (6, 0, 3), (6, 6, 3), (0, 6, 3)]) == 4
At our site we encourage you to use type hints. At many solutions you may using of lambdas. In today's articles you may read about it more! Also look with us into a future of Data Science.
How to Use Type Hints for Multiple Return Types in Python - In Python, type hinting is an optional yet useful feature to make your code easier to read, reason about, and debug. With type hints, you let other developers know the expected data types for variables, function arguments, and return values. As you write code for applications that require greater flexibility, you may need to specify multiple return types to make your code more robust and adaptable to different situations.
What are lambda expressions? - Have you ever seen the word lambda used in Python? What are lambda expressions and lambda functions? And how are lambda functions different from other functions in Python?
2023 and Beyond: The Future of Data Science Told By 79,306 People - Data science has been the hottest thing for a while now, but it still continues to be a major talking point even today.
We decided to look further into how data science and its usage are evolving. By comparing the results from the 2021 Python Developers Survey and the 2022 Python Developers Survey, we discovered some insights that support the claim that data science is indeed on the rise.
The data for both the 2021 and 2022 Python Developers Surveys were collected from over 40,000 and 39,000 individuals, respectively, from PSF (Python Software Foundation). Hence, the data and our findings don’t represent the whole Data Science community.
Dear users, we strongly invite you to make code reviews to help others to improve their code! 🤝
🙌 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