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
  • Computer 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 cubic cell calculator
ChemistryMediumHigh School (11–12)Solid State

A cubic cell calculator

You will write four functions that answer most questions on cubic cells. One gives the number of atoms in a cell. One gives the radius of an atom from the edge. One gives the packing efficiency. One gives the density.

The idea. A simple cubic cell holds 1 atom, bcc holds 2 and fcc holds 4. The contact rules are a=2ra = 2ra=2r, 3 a=4r\sqrt{3}\,a = 4r3​a=4r and 2 a=4r\sqrt{2}\,a = 4r2​a=4r. The packing efficiency is Z⋅43πr3a3\dfrac{Z \cdot \tfrac43\pi r^3}{a^3}a3Z⋅34​πr3​, and the density is ρ=ZMNAa3\rho = \dfrac{ZM}{N_A a^3}ρ=NA​a3ZM​ with aaa in cm.

Your tasks.

  1. Complete atoms_per_cell(kind) for "sc", "bcc" and "fcc".
  2. Complete radius(kind, a) so that it returns the radius in pm from the edge in pm.
  3. Complete packing(kind) so that it returns the fraction of the cell that the atoms fill. Use any edge you like.
  4. Complete density(kind, M, a) so that it returns the density in g/cm³, with M in g/mol and a in pm.

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 density("fcc", 63.55, 361.5). It is the density of copper.

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 condensation polymer calculatorFormulas from voids →
More onSolid State

Discussion (0)

Log in to join the discussion.

Loading…

More labs on this topic

  1. An indexing machineHard
  2. A Bragg's law toolkitMedium
  3. A defect calculatorMedium
  4. Ionic structures from their radiiMedium
  5. Formulas from voidsMedium
All labs on this topic →