Python: Ball Selection (Gr. 11-12)

Python Coding: Advanced


In this lesson, students will explore the use of functions in Python. Students will use the function to create a computational model on the ball selection probability. Students will then create a ‘ball drawing’ function and define how it should work to simulate the ball selection. Students also need to recall and utilize what they have learned about lists to store and modify data.


  • Recognize the syntax and features of a function in Python, including the keyword, the rule of indentation, the method to call and reuse the function.
  • Write and execute algorithms that define a function to store a set of instructions or procedures.

Curriculum Connections Summary

  • Ontario - 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.