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
  • Blog

Account

  • Log in
© 2026 senLearn. All rights reserved.HelpAboutContactPrivacy PolicyTerms of UseRefund Policy
  1. Python Labs
  2. /The failure table
BiologyEasyHigh School (11–12)Human Body › Reproductive Health

The failure table

A dictionary holds the typical use failure rates of some methods, as pregnancies in the first year among 100100100 users. You will find the pregnancies expected in a group, the chance over several years, and the method with the lowest rate.

The idea. In a group of nnn couples, about n×rate100\dfrac{n \times \text{rate}}{100}100n×rate​ pregnancies are expected in a year. The chance of at least one pregnancy in ttt years is 1−(1−rate/100)t1 - (1 - \text{rate}/100)^t1−(1−rate/100)t.

Your tasks.

  1. Finish expected. It gives the pregnancies expected in a year among couples couples.
  2. Finish chance. It gives the chance of at least one pregnancy in years years, as a number from 000 to 111.
  3. Finish best. It gives the name of the method with the lowest rate.

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, call chance(rates["male condom"], 10). Is it more than one half?

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
More onHuman Body › Reproductive Health

Discussion (0)

Log in to join the discussion.

Loading…

Learn it in

  1. What each method of birth control protects againstReproductive Health: Comparing Methods and Technologies

More labs on this topic

  1. Exact chances of embryosMedium
  2. The transfer plannerMedium
  3. The infection tableEasy
  4. The fertile windowMedium
The doubling timeEasy
All labs on this topic →