The quiz 07 was divided in two parts; the first asked for a program, with a function, that gives you tha distance between two points in coordinates x and y. It was easy, just had to use the pythagoream theorem, the one that says that, for a triangle with a pi angle, the result of the hypotenuse, opposite to the 90 degree angle, will be the square root of the sum of the square of the other two sides:

hypotenuse = (  (adjacent side)^2  + (opposite side)^2  )^(1/2)

So it was easy, just substracted to the larger x and y coordinate to the lower, and do the pythagorean theorem:

quiz 7 p1

github link

The second part ask for a program, again with function, that tells the user the number in the position the user asked in the Fibonacci list. I had to think differently to reach the conclusion that the program can be solved as “moving” the first two variables and then addem, something like the number before the result is the result, and the number before the number before the result is the number before the result, then loop it the times the user inputs, and that’s it; BTW, the Fibonacci list is the numbers that represents:

So here is the code:

quiz 7 p2

github link

BTW, I used notepad because my laptop was crashed by some evil person 🙁

I tested it in the Python shell in the webpage python.org

CC BY 4.0 Quiz 07: A good time to think by charliegdrummer is licensed under a Creative Commons Attribution 4.0 International License.