Post image
Light Mode
Dark Mode
This week's missions: Is Even, Non Empty Lines, and Find Rectangles
checkio

Good day CheckiO users!

Great news for those who are also polishing their skills on our JS portal or just thinking about learning JavaScript. We've switched to TypeScript, which also includes the latest ECMAScript standard. We believe it will attract more unique and interesting solutions. See all about it in our previous blog post.

Challenge yourself with our latest missions:

The first mission is Find Rectangles created by Phil15. It's a new mission for the Maya Island in which your task is to divide a rectangular grid into rectangles of specific areas.

rectangles([[3, 0, 0, 0, 0, 2],
            [2, 0, 0, 4, 0, 0],
            [0, 5, 0, 0, 0, 0],
            [3, 0, 3, 2, 0, 0],
            [0, 0, 2, 0, 0, 6],
            [0, 0, 0, 4, 0, 0]]) == {(0, 0, 0, 2), (1, 2, 3, 2), (1, 1, 5, 1), (1, 0, 2, 0),
                                     (3, 0, 5, 0), (2, 4, 4, 5), (0, 5, 1, 5), (0, 3, 1, 4),
                                     (2, 3, 3, 3), (4, 2, 4, 3), (5, 2, 5, 5)}

The second is the Non Empty Lines mission and here you should count the number of non-empty lines in the text.

non_empty_lines('one simple line') == 1
non_empty_lines('') == 0
non_empty_lines('\nonly one line\n            ') == 1
non_empty_lines('''
Lorem ipsum dolor sit amet,

consectetur adipiscing elit
Nam odio nisi, aliquam
            ''') == 3

The third mission is called Is Even where you have to find out whether the given number is even or odd.

is_even(2) == True
is_even(5) == False
is_even(0) == True

The users who’ve made the TOP 3 this month are piter239, mikenon, and B_dur. You are doing great, guys! Keep on coding!

Created: April 29, 2020, 11:39 a.m.
0
40
User avatar
oduvan