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 →

Learn

  • Physics
  • Chemistry
  • Mathematics
  • Biology
  • Python Programming
  • Statistics & Data 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. /Points that divide a line
MathematicsEasyHigh School (9–10)Vectors and Three-Dimensional Geometry › Vector Algebra

Points that divide a line

You will find the vector between two points and the point that divides a line in a given ratio, and then place four points along a line.

Your tasks.

  1. In vector, return the vector from the point p to the point q.
  2. In divide, return the point P on the line from p to q with p to P : P to q equal to m : n.
  3. Set points to the four points that divide the line from A = (-2, 4) to B = (8, -6) in the ratios k : (5 - k) for k = 1, 2, 3, 4, in that order.

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, add the midpoint with divide(A, B, 1, 1). Is it one of the four points?

StemPy LabContributed by StemPy Lab
python
Loading Python runtime…

A 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
← Whole-number magnitudesParallel vectors and collinear points →
More onVectors and Three-Dimensional Geometry › Vector Algebra

Discussion (0)

Log in to join the discussion.

Loading…

Learn it in

  1. Position vectors and directed line segmentsVector Geometry

More labs on this topic

  1. Moving particlesMedium
  2. Parallel vectors and collinear pointsMedium
  3. Whole-number magnitudesMedium
  4. Vector arithmetic with functionsEasy
Volumes and coplanar points by computerMedium
All labs on this topic →