HelpContactFor teachers and institutes
>_StemPy Lab
Mock TestsClasses

>_StemPy Lab

Learn. Solve. Code the solutions. Test yourself.

Live examsFree mock exams, timed and rankedEveryone starts together, and your score and rank come the moment it ends.See the exams →
Live examsInternational live exams are comingTell us which exam you want first. Timed practice papers are open now.See what is coming →

Learn

  • Physics
  • Chemistry
  • Mathematics
  • Biology
  • Python Programming
  • Statistics & Data Science
  • Computer Science
  • Space Science and Astronomy
  • Earth and Environmental Science
  • Classes
  • Groups

Practice

  • Problems
  • Quizzes
  • Mock Tests
  • Prepare for an Exam
  • Question Sets
  • Exams
  • Certificates
  • Python Labs
  • AI Practice Generator
  • Student-Created Tests

Community

  • Discussions
  • Resources
  • Notes
  • Glossary
  • Blog

Account

  • Log in
© 2026 senLearn. All rights reserved.HelpFor SchoolsAboutContactPrivacy PolicyTerms of UseRefund Policy
  1. Python Labs
  2. /The Euler line on coordinates
MathematicsHardHigh School (11–12)Euclidean Geometry

The Euler line on coordinates

You will find the centroid and the orthocentre of a triangle from its corners and its circumcentre, and then test the Euler line. Points are pairs (x, y).

The idea. The centroid is the average of the corners. With the circumcentre OOO known, the orthocentre is H=A+B+C−2OH = A + B + C - 2OH=A+B+C−2O, worked out one coordinate at a time. On the Euler line, GH=2 OGGH = 2\,OGGH=2OG.

Your tasks.

  1. Finish centroid(A, B, C). Return the point GGG.
  2. Finish orthocentre(A, B, C, O). Return H=A+B+C−2OH = A + B + C - 2OH=A+B+C−2O.
  3. Finish euler_ratio(O, G, H). Return GHOG\dfrac{GH}{OG}OGGH​, using math.dist.

Run it first, just as it is. The checker at the end prints FAIL for each task. Then do the tasks one at a time, and run the program again after each one. A Hint appears under every check that still fails.

When every line says PASS, try the triangle (0,0)(0, 0)(0,0), (10,0)(10, 0)(10,0), (3,9)(3, 9)(3,9) with O=(5,10/3)O = (5, 10/3)O=(5,10/3). Is the ratio still 222?

StemPy LabContributed by StemPy Lab
python
Loading Python runtime…

A worked solution

Run your code once to unlock the worked solution.

Have you tried it?

Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.

Log in to save
← All Labs
← Bisector, median and StewartPower, tangent and radical axis →
More onEuclidean Geometry

Discussion (0)

Log in to join the discussion.

Loading…

Learn it in

  1. Triangle centres and the Euler lineCeva, Menelaus and the Centres of a Triangle

More labs on this topic

  1. Ptolemy and Brahmagupta on a circleHard
All labs on this topic →