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. /A tester for laws and circuits
MathematicsEasyHigh School (11–12)Mathematical Reasoning

A tester for laws and circuits

You will write a tester that decides whether a statement is a tautology and whether two statements are equivalent. Then you use it on a switching circuit.

The idea. A tautology is true in every row. Two statements are equivalent when they agree in every row. A circuit with switches in series is an "and"; in parallel it is an "or".

Your tasks.

  1. Finish is_tautology(f, n). Return True when f is true in every row.
  2. Finish equivalent(f, g, n). Return True when f and g agree in every row.
  3. Finish circuit(p, q, r). It is the circuit with PPP in series with a block of QQQ and RRR in parallel. Return whether the lamp glows.

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 equivalent to compare circuit with (p and q) or (p and r). Which law of the lesson does this show?

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
← A truth table makerFour related conditionals →
More onMathematical Reasoning

Discussion (0)

Log in to join the discussion.

Loading…

Learn it in

  1. Tautologies, equivalence and switching circuitsStatements, Connectives and Truth Tables

More labs on this topic

  1. A counterexample hunterEasy
  2. An argument checkerEasy
  3. A checker for for-all and there-existsEasy
  4. Four related conditionalsEasy
A truth table makerEasy
All labs on this topic →