• This week’s missions: Searchlights and Inscribe a Contour

checkio

Hi, guys!

Test yourself and have fun with the new missions we have for you:

The first mission was created by kurosawa4434 and is called the “Searchlights”, where your task is to determine the number of the regular polygons can you see in the light.

searchlights([(2, 3, 2, 3)], [(1, 2, 1)]) == 1 # regular triangle
searchlights([(4, 5, 2, 4)], [(4, 4, 3)]) == 4 # square

The second one is the “Inscribe a Contour” mission created by quarkov, where you are given a list of dots, each represents a projection of a 3D model vertex onto a horizontal plane and you need to find the smallest rectangle (by its area) into which all the given dots (and thus the projected contour) can be inscribed.

inscribe([(1, 1), (1, 2), (0, 2), (3, 5), (3, 4), (4, 4)]) == 6.0                               #example №1
inscribe([(6, 5), (10, 7), (2, 8)]) == 20.0                                                     #example №2
inscribe([(2, 3), (3, 8), (8, 7), (9, 2), (3, 2), (4, 4), (6, 6), (7, 3), (5, 3)]) == 41.538    #example №3

The users who’ve made the TOP 3 this month are mortonfox, flpo, and kkkkk. You are doing great, guys! Keep on coding!