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

A hydrogen chloride calculator

You will write four small functions for the laboratory preparation of hydrogen chloride.

The idea. One mole of sodium chloride (Mr=58.5M_r = 58.5Mr​=58.5) gives one mole of hydrogen chloride. One mole of gas fills 22.4 dm322.4\ \text{dm}^322.4 dm3 at S.T.P. Below 200 ∘C200\ ^\circ\text{C}200 ∘C one mole of sulphuric acid (Mr=98M_r = 98Mr​=98) reacts with one mole of salt. Above 200 ∘C200\ ^\circ\text{C}200 ∘C it reacts with two. A very soluble gas is collected by upward displacement of air if its MrM_rMr​ is more than 28.8, and by downward displacement if it is less.

Your tasks.

  1. Complete moles_hcl(mass_salt).
  2. Complete volume_stp(moles), in dm3\text{dm}^3dm3.
  3. Complete acid_used(mass_salt, above_200), the mass of sulphuric acid in grams.
  4. Complete collection(mr) so that it returns "upward" or "downward".

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, try collection(17). Which gas has this MrM_rMr​?

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
← Rf values and a gas chromatogramWhat does hydrochloric acid give? →
More onThe p-Block Elements › Groups 17 and 18: Halogens and Noble Gases

Discussion (0)

Log in to join the discussion.

Loading…

Learn it in

  1. Preparing dry hydrogen chlorideHydrogen Chloride and Hydrochloric Acid

More labs on this topic

  1. What does hydrochloric acid give?Medium
  2. A halogen displacement predictorMedium
  3. A halogen trends calculatorEasy
  4. Count the electron pairs and name the shapeMedium
Will the halogen displace the halideEasy
All labs on this topic →