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. /Counting with a condition
MathematicsMediumHigh School (9–10)Algebra › Permutations and Combinations

Counting with a condition

You will count arrangements and numbers by listing all of them with a condition, and compare with the rules of the lesson.

Your tasks.

  1. Set together to the number of ways to seat the six people "ABCDEF" in a row so that "A" and "B" are next to each other. List every row and keep those where the seats of A and B differ by 111.
  2. Set even_numbers to the number of four-digit numbers made from the digits 000 to 555, with no digit repeated, no leading zero and an even last digit.
  3. Set rule to the answer to task 1 from the rule: 2×5!2 \times 5!2×5!. Use math.factorial.

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 count to seven people. What does the rule give for 2×6!2 \times 6!2×6!?

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
← Counting with loopsMoving particles →
More onAlgebra › Permutations and Combinations

Discussion (0)

Log in to join the discussion.

Loading…

Learn it in

  1. Permutation or combination?Counting Arrangements and Selections

More labs on this topic

  1. Counting with loopsEasy
  2. Committees with conditionsMedium
  3. nCr three waysEasy
  4. Words, repeats and ranksMedium
  5. Counting arrangements two ways
Easy
All labs on this topic →