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. /A halogen trends calculator
ChemistryEasyHigh School (9–10)The p-Block Elements › Groups 17 and 18: Halogens and Noble Gases

A halogen trends calculator

You will write three small functions for the halogens. One decides the state of a halogen at room temperature from its melting and boiling points. One finds the average step in a list of values. One predicts the next value down the group.

The idea. A substance is a solid if room temperature is below its melting point. It is a liquid if room temperature is above the melting point but below the boiling point. Otherwise it is a gas. A trend can be continued: the next value is the last value plus the average step.

Your tasks.

  1. Complete state_at_room(melting, boiling). Room temperature is room, which is 20 ∘C20\ ^\circ\text{C}20 ∘C.
  2. Complete average_step(values). It returns the average of the differences between neighbouring values.
  3. Complete predict_next(values). It returns the last value plus the average step.

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 predict_next([-101, -7, 114]). Does the answer match the astatine problem?

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
← A reversible reaction simulatorA halogen displacement predictor →
More onThe p-Block Elements › Groups 17 and 18: Halogens and Noble Gases

Discussion (0)

Log in to join the discussion.

Loading…

More labs on this topic

  1. A halogen displacement predictorMedium
  2. Count the electron pairs and name the shapeMedium
  3. Will the halogen displace the halideEasy
All labs on this topic →