/Robin_Hood

Primary LanguageJupyter NotebookMIT LicenseMIT

Robin Hood

Robin Hood:

We're in the middle of the competition to win the archery contest in Sherwood. With our bow and arrows we shoot at a target and try to hit as much as possible in the center.

The center of the target is represented by the values ​​(0, 0) on the coordinate axes.

Description:

In 2-dimensional space a point can be defined by a pair of values ​​that correspond to the horizontal (x) and vertical (y) coordinates. The space can be divided into 4 zones (quadrants): Q1, Q2, Q3, Q4. Whose unique joining point is the point (0, 0).

If a point is in Q1, both its x and y coordinates are positive. I leave you a link to wikipedia so you can familiarize yourself with these quadrants.

Objectives:

  • data structures: lists, sets, tuples
  • logical operators: if-elif-else
  • loop: while/for
  • calculation of minimum (optional sorting)

Having this:

puntos = [(4,5), (-0,2), (4,7), (1,-3), (3,-2), (4,5), (3,2), (5,7), (-5,7), (2,2), (-4,5), (0,-2), (-4,7), (-1,3), (-3,2), (-4,-5), (-3,2), (5,7), (5,7), (2,2), (9, 9), (-8, -9)]

Tasks:

  1. Robin Hood is famous for hitting an arrow with another arrow. Have you got it?
  2. Calculate how many arrows have fallen in each quadrant.
  3. Find the point closest to the center. Calculate its distance from the center
  4. If the target has a radius of 9, calculate the number of arrows that must be collected from the forest.

Solution: