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
  • 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. /The choice chamber checker
BiologyHardHigh School (11–12)Animal Behaviour and Ethology

The choice chamber checker

You will predict where woodlice gather and test a real count with chi-squared.

The idea. If a woodlouse walks at vdv_dvd​ in the damp half and vyv_yvy​ in the dry half, the share of time in the damp is vy/(vd+vy)v_y / (v_d + v_y)vy​/(vd​+vy​). Chi-squared is ∑(O−E)2/E\sum (O - E)^2 / E∑(O−E)2/E over the two sides. A value over 3.84 is significant at the 5 per cent level for one degree of freedom.

Your tasks.

  1. Finish damp_share. It gives the share of time in the damp half.
  2. Finish chi_square. It takes a list of observed counts and a list of expected counts.
  3. Finish is_real. It gives True when the chi-squared value is more than the critical value.

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 chi_square([31, 19], [25, 25]). Is that split real?

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
← The fishery modelThe learning curve lab →
More onAnimal Behaviour and Ethology

Discussion (0)

Log in to join the discussion.

Loading…

More labs on this topic

  1. The migrant's plannerHard
  2. The forager's calculatorHard
  3. The kin and flock calculatorHard
  4. The dance decoderHard
  5. The learning curve labHard
All labs on this topic →