Dictionaries and Functions as Arguments
暂无分享,去创建一个
In Python it is possible to have a container of data that is accessed via unique strings called keys. This container is called a dictionary and gives the programmer the ability to make powerful data structures. The values inside a dictionary can be a variety of data types; indeed, a dictionary can contain other dictionaries, as we will show. The ability to pass the name of a function as a parameter to another function is demonstrated via a numerical integration example. Finally, lambda functions are introduced as a flexible method to define functions in a single line of code. The scope of lambda functions is also discussed.