Unit 9 · Lesson 5
Build the idea
Start with the concept and its key vocabulary.
An array can be supplied as a parameter just like one number or string. The sub-program can inspect each element, calculate from it or build a new array to return. Passing the collection keeps the sub-program reusable and avoids a global array. Indices begin at 0, so an ERL loop normally runs from 0 to array.length - 1; Python uses range(len(array)).
A parameter that receives an array or Python list from the caller.
A zero-based position used to access an array element.
Send a complete processed array back from a function.
Able to be changed after creation; Python lists are mutable.