Python: Guess the Number (Gr. 9-10)


In this lesson, students are introduced to the while loop in Python through another classic probability experiment. Students will explore how to calculate the probability of guessing a selected number from a list of random integers by using the while loop. To maximize the probability of guessing the correct number, students will address the uniform distribution problems and use the computational model to decrease the probability distribution.


  • Use the mBlock Python editor interface
  • Implementing while loops in Python
  • Boolean data types and values and how they are used inside conditional statements

Curriculum Connections Summary

  • Ontario - Mathematics & Computer Science
  • Quebec - Coming Soon!
  • New Brunswick - Coming Soon!
  • Nova Scotia - Coming Soon!
  • Alberta - Coming Soon!
  • British Columbia - Coming Soon!
  • Manitoba - Coming Soon!
  • Prince Edward Island - Coming Soon!
  • Saskatchewan - Coming Soon!
  • Newfoundland & Labrador - Coming Soon!
  • Yukon Territories - Follow's B.C.'s Curriculum
  • Northwest Territories - Follows Alberta's Curriculum
  • Nunavut - Follows Alberta's Curriculum

Find Out More

mBlock (Python Coding)
mBlock (Python Coding)

mBlock and Python Coding - The Programming Language of the Future

Python is an interpreted, object-oriented, high-level programming language with dynamic semantics. Python's simple, easy to learn syntax emphasizes readability and therefore reduces the cost of program maintenance. With mBlock, Python supports modules and packages, which encourages program modularity and code reuse. The Python interpreter and the extensive standard library are available in source or binary form.