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. /Clock speed, cores and time
Computer ScienceEasyHigh School (9–10)Computer Science › Computer Hardware

Clock speed, cores and time

You will write three small functions for the simple model of performance: one instruction in each clock cycle on each core.

Your tasks.

  1. In cycles_per_second, return the number of cycles each second for a clock speed given in GHz.
  2. In task_time, return the time in seconds for a task of cycles cycles on one core.
  3. In time_on_cores, return the time when the fraction shared of the work is split equally between cores cores and the rest runs on one core.

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 time_on_cores(12e9, 3, 1000, 0.75). Why is it not close to zero?

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
← Fetch, decode and execute in PythonPlanning a 3D print →
More onComputer Science › Computer Hardware

Discussion (0)

Log in to join the discussion.

Loading…

More labs on this topic

  1. Reading MAC and IP addressesMedium
  2. Storage sums with 1024Easy
  3. A greenhouse controllerMedium
  4. Planning a 3D printEasy
  5. Fetch, decode and execute in PythonMedium
All labs on this topic →