• This week's missions: Count Comprehensions and Mountain Scape

checkio

Hello CheckiO users! ๐Ÿ™‚

๐Ÿ’ช Challenge yourself with our latest missions:

The first one is called Count Comprehensions created by Phil15 and here you should write a function that counts list/set/dict/generator comprehensions and returns those counts.

count_comprehensions('[n ** 2 for n in range(5)]') == {'ListComp': 1}
count_comprehensions('list(n ** 2 for n in range(5))') == {'GeneratorExp': 1}
count_comprehensions('''\
limit = 100
assert all(
    sum(n ** 3 for n in range(N)) == (N * (N - 1) // 2) ** 2
    for N in range(1, limit)
)
''') == {'GeneratorExp': 2}

The second mission is Mountain Scape created by kurosawa4434 where your task is to find the total area of all triangles considering the indicated condition.

mountain_scape([(1, 1), (4, 2), (7, 3)]) == 13
mountain_scape([(0, 2), (5, 3), (7, 5)]) == 29
mountain_scape([(1, 3), (5, 3), (5, 5), (8, 4)]) == 37
    ๐Ÿ’ก Highlights from the world of Python:
  • Exhaustiveness checking is a very useful feature of type checkers. Check out how you can get mypy to perform exhaustiveness checking, so you could get errors at compile time rather than at run time. It's simply amazing!
  • You want to protect your code from easily preventable bugs? Find out all you need to know about Python type checking! You'll see why do you need it and what's the difference between static and runtime type checking, along with useful tools, clear explanations and accompanying examples.
  • A new major version Qt 6.0 has been released! See what core focus areas has been improved and what new features, functionality, and better support requirements has been implemented.

๐Ÿ‹ Our congratulations to the winner of November 2020 - GrigorySol - you are totally Awesome and we are very glad to have you here with us! ๐Ÿ‘

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