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
  • Computer 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. /Write a test plan that finds an error
Computer ScienceMediumHigh School (9–10)Computer Science › Algorithms and Problem-Solving

Write a test plan that finds an error

A pool gives a teen ticket to ages 131313 to 191919, both included. You will write the check, a test plan with every kind of test data, and a loop that runs the plan.

Your tasks.

  1. In is_teen, return True only for a whole number from 13 to 19. Return False for anything else, including text.
  2. Fill the list tests with pairs (age, expected). Include a normal value, both extreme values, both rejected boundary values and one abnormal value that is text.
  3. Set passed to the number of tests where is_teen(age) equals the expected result.

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, change the check to 13 < age <= 19. Which of your tests fails now? Which kind of test data found it?

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
← Pseudocode into PythonThe standard methods by hand →
More onComputer Science › Algorithms and Problem-Solving

Discussion (0)

Log in to join the discussion.

Loading…

Learn it in

  1. Test data and finding errorsPseudocode, Trace Tables and Testing

More labs on this topic

  1. Search, sort and checkMedium
  2. The standard methods by handEasy
  3. Pseudocode into PythonEasy
  4. From flowchart to PythonMedium
  5. Split a ticket program into sub-tasks
Easy
All labs on this topic →