# Strings Lists, Tuples and Dictionaries ## Strings > A string is a sequence **len** - built in funciton that returns the number of characters in a string **object:** Something a variable can refer to. For now, you can use “object” and “value” interchangeably. **sequence:** An ordered collection of values where each value is identified by an integer index. **item:** One of the values in a sequence. **index:** An integer value used to select an item in a sequence, such as a character in a string. In Python indices start from 0. **slice:** A part of a string specified by a range of indices. **empty string:** A string with no characters and length 0, represented by two quotation marks. **immutable:** The property of a sequence whose items cannot be changed. **traverse:** To iterate through the items in a sequence, performing a similar operation on each. **search:** A pattern of traversal that stops when it finds what it is looking for. **counter:** A variable used to count something, usually initialized to zero and then incremented. **invocation:** A statement that calls a method. **optional argument:** A function or method argument that is not required. **file object:** A value that represents an open file. **reduction to a previously solved problem:** A way of solving a problem by expressing it as an instance of a previously solved problem. **special case:** A test case that is atypical or non-obvious (and less likely to be handled correctly). ## Lists **list:** A sequence of values. **element:** One of the values in a list (or other sequence), also called items. **nested list:** A list that is an element of another list. **accumulator:** A variable used in a loop to add up or accumulate a result. **augmented assignment:** A statement that updates the value of a variable using an operator like +=. **reduce:** A processing pattern that traverses a sequence and accumulates the elements into a single result. **map:** A processing pattern that traverses a sequence and performs an operation on each element. **filter:** A processing pattern that traverses a list and selects the elements that satisfy some criterion. **object:** Something a variable can refer to. An object has a type and a value. **equivalent:** Having the same value. **identical:** Being the same object (which implies equivalence). **reference:** The association between a variable and its value. **aliasing:** A circumstance where two or more variables refer to the same object. **delimiter:** A character or string used to indicate where a string should be split. ## Dictionaries **mapping:** A relationship in which each element of one set corresponds to an element of another set. **dictionary:** A mapping from keys to their corresponding values. **key-value pair:** The representation of the mapping from a key to a value. **item:** In a dictionary, another name for a key-value pair. **key:** An object that appears in a dictionary as the first part of a key-value pair. **value:** An object that appears in a dictionary as the second part of a key-value pair. This is more specific than our previous use of the word “value”. **implementation:** A way of performing a computation. **hashtable:** The algorithm used to implement Python dictionaries. **hash function:** A function used by a hashtable to compute the location for a key. **hashable:** A type that has a hash function. Immutable types like integers, floats and strings are hashable; mutable types like lists and dictionaries are not. **lookup:** A dictionary operation that takes a key and finds the corresponding value. **reverse lookup:** A dictionary operation that takes a value and finds one or more keys that map to it. **raise statement:** A statement that (deliberately) raises an exception. **singleton:** A list (or other sequence) with a single element. **call graph:** A diagram that shows every frame created during the execution of a program, with an arrow from each caller to each callee. **memo:** A computed value stored to avoid unnecessary future computation. **global variable:** A variable defined outside a function. Global variables can be accessed from any function. **global statement:** A statement that declares a variable name global. **flag:** A boolean variable used to indicate whether a condition is true. **declaration:** A statement like global that tells the interpreter something about a variable. ## Tuples **tuple:** An immutable sequence of elements. **tuple assignment:** An assignment with a sequence on the right side and a tuple of variables on the left. The right side is evaluated and then its elements are assigned to the variables on the left. **gather:** An operation that collects multiple arguments into a tuple. **scatter:** An operation that makes a sequence behave like multiple arguments. **zip object:** The result of calling a built-in function zip; an object that iterates through a sequence of tuples. **iterator:** An object that can iterate through a sequence, but which does not provide list operators and methods. **data structure:** A collection of related values, often organized in lists, dictionaries, tuples, etc. **shape error:** An error caused because a value has the wrong shape; that is, the wrong type or size.