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. /Solving a triangle
MathematicsHardHigh School (11–12)Geometry › Triangles

Solving a triangle

You will write three small solvers. Angles are in degrees and sides in cm.

The idea. The cosine rule gives the third side from two sides and the angle between them, and an angle from three sides. For two sides aaa, bbb and an angle AAA not between them, there are 000, 111 or 222 triangles.

Your tasks.

  1. Finish third_side(b, c, A). Return aaa from a2=b2+c2−2bccos⁡Aa^2 = b^2 + c^2 - 2bc\cos Aa2=b2+c2−2bccosA.
  2. Finish angle_A(a, b, c). Return angle AAA in degrees.
  3. Finish count_ssa(a, b, A). Return the number of triangles. Use h=bsin⁡Ah = b\sin Ah=bsinA: none if a<ha < ha<h; one if a=ha = ha=h or a≥ba \ge ba≥b; two if h<a<bh < a < bh<a<b. Assume AAA is acute.

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, use count_ssa for a=6a = 6a=6, b=10b = 10b=10 and A=30∘A = 30^\circA=30∘. Does it agree with the lesson?

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
← Ptolemy and Brahmagupta on a circleFive areas and two radii →
More onGeometry › Triangles

Discussion (0)

Log in to join the discussion.

Loading…

Learn it in

  1. The sine, cosine and projection rulesSolving Triangles, Their Areas and Constructions

More labs on this topic

  1. Bisector, median and StewartHard
  2. Right, acute or obtuse?Medium
  3. Do the triangles match?Medium
  4. Cutting the sides of a triangleEasy
Are two triangles similar?Medium
All labs on this topic →