Curriculum Portal

Select a course.

arrow_back

AI and Machine Learning

infoWhy this? Functions, procedures, parameters, return values, scope, and lists enable us to build modular programs that are easier to understand, reuse, test, and debug. These techniques also allow collections of data to be processed safely and systematically.

scheduleWhy now? Earlier Python work established decisions and loops, so we can now encapsulate familiar control-flow patterns and apply them to collections of data. Secure knowledge of functions, indexing, and list processing directly prepares us to implement and compare search and sort algorithms.

neurologyYou need to know

  • A function groups reusable code under a single name.
  • A procedure is a subroutine that does not return a value.
  • Decomposing programs into functions improves testing and debugging.
  • Parameters are placeholders in a function definition.
  • Arguments are the actual values passed in a function call.
  • return sends a value back to the caller.
  • Local variables exist only within their function scope.
  • Lists are ordered, mutable collections.
  • Index 0 refers to the first list item.
  • len() returns the number of items in a list.
  • append(), pop(), and remove() mutate list contents.
  • Iterating over a list can be done by index or by item, and off-by-one errors are common when indexing.
  • Good test data includes empty, typical, and edge-case lists.

rocket_launchYou must be able to

  • Write functions and procedures with purposeful names and structure.
  • Manipulate list data safely using indexing and list methods.
  • Use loops to process list data (e.g., totals, counts, finding a maximum).
  • Decompose, test, and debug a small program that uses functions and lists.


Revision Quiz

trophy Congratulations! You have completed the quiz.