CAS CS 111 Lecture Notes - Lecture 10: Higher-Order Function
CAS CS 111 verified notes
10/38View all
Document Summary
Range (low, high): allows us to work with the range of integers from low to high-1. If you omit low, the range will start at 0. You can think of range as producing a list and in many cases it can be used like one. To see the actual list, we used to use range i conjunction with a nother function called list: Another useful build in function sum(list): computes & returns the sum of a list of numbers. Python treats functions are "first-class citizens" of the language. This means that functions are actually data - and can be treated just like other types of data. Pass a function as an input to another functions. Return a function as the result of another functions. A function that takes another function as input is known as a higher- order function. map() Applies function to each element of sequence and returns the results. You can think of map as producing a list.