1/41
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Argument
An expression that appears within the parentheses of a function call. When executing this function call, Python evaluates the expression and copies its values into the appropriate parameters.
Example: Function call round(a+b, 1) both a+b and 1 are ___.
Assert Statement
A statement of the form:
___<boolean-expression> or ___ <boolean-expression>, <string-expression>
If the boolean expression is true, this statement does nothing, If it is false, it produces an error, stopping the entire program. In the second version of this, it uses the string expression after the commas as its error message.
Assignment Statement
A statement of the form: <variable> = <expression>
If the variable on the left hand side does not exist yet, it creates and stores the value of the expression inside. If the variable does exist, it replaces the old value with the value of the expression.
Attribute
These are variables that are stored inside of an object. They can often be modified, though not always the case. These typically have invariants which are rules specifying how it may be modified.
Example: If the variable color stores an RGB object, then color.red is the red __ in this object
Call Frame
A formal representation of that Python uses when you execute a function call. Contains the name of the function as well as all parameters and local variables. Also has an instruction counter that tracks the next line in the function that is to be executed.
Call Stack
All of the call frames of the currently executing function calls. These call frames are arranged in a stack, with the original function up top, and the most recent function call at the bottom.
Class
Any type that is not built-in to Python. Like functions, these are defined in modules, and we have to import the module to use values of that type.
Conditional Statement
if <boolean-expression>:… else <statement>
Constructor
A function that creates a mutable object. It puts the object in heap space, and returns the name of the object so you can store it in a variable.
Expression
Python code that produces a value. Cannot be used by themselves; they must be put inside of a statement.
Function
A parameterized sequence of statements, whose execution performs some task. There are three kinds of ___: procedure, fruitful function, constructor. Methods are considered to be this.
Function Call
An invocation of the function with arguments. When done, these arguments are placed into the parameter variables, and the body of the function is executed. Associated with a call frame which stores the parameters and local variables as the body is being executed.
Function Header
The first line of a function definition. It includes the keyword def, the function name, parentheses, any parameters (if appropriate) and a colon.
Global Space
An area of memory that stores any variable that is not defined in the body of a function. These variables include both function names and modules names, though it can include variables with more traditional values.
The Heap
An area of memory that stores mutable objects like folders. Stores function definitions, and the contents of modules imported with the import command.
Remains unless are explicitly erased or quit Python. Cannot access this space directly. Access using variables in global space or in call frame that contain the name of the object in space.
Literal
An expression which when evaluated, evaluates to itself. Hence it is also a value.
Method
Functions that are stored inside of an object. They can either be procedures or fruitful functions. They are called by placing the object variable and a dot before the function name.
Example: s.find(s1)
Object
A value whose type is a class. These typically contain attributes, which are variables inside of this which can potentially be modified. In addition, these often have methods, which are functions that are stored inside of the object.
Parameter
A variable in the parentheses of a function header.
Ex: def after_space(s), this is the variable s
Print Statement
The expression evaluates to a value of type string.
Procedure
A function that performs some task and does not return a value. These may be used as statements.
Return Statement
Placed at the end of a function to return a value
Scope
A set of places in which it can be referenced. Global variables may be referenced by any function that which is either defined in the same module as the global variable, or which imports that module. The body of the function in which it is defined.
Specification
A description of what a function should do. Should include (1) preconditions on the arguments, (2) the return value of the function. Typically written as a docstring comment.
Statement
A command for Python to do something. Any procedure may be used as this.
Type
A set of values and the operations on them. Basic examples are int, float, bool, and str. list is like str, except the contents are mutable.
Variable
A named box that can contain a value. We change the contents of this through an assignment statement. This is created when it is assigned for the first time. Four types of this include parameters, local variables, global variables, and attributes.
Local Variable
A variable which is not a parameter, but which is first assigned in the body of a function.
Ex: pos = s.find(‘ ‘), pos is this variable
Global Variable
A variable which is assigned inside of a module, but outside of the body or header of any function.
Expressions
Collections of values and operators, including variable names and function calls
State Diagrams
A common way to represent variables on paper is to write the name with an arrow pointing to its value.
Module
A collection of variables and functions
Tracebacks
When a runtime error occurs in a function, Python displays the name of the function that was running, the name of the function that called it, etc.
String
A sequence of characters
len
A built-in function that returns the number of characters in a string
String Slices
A segment of a string is called a slice
Boolean Expressions
An expression that is either true or false
Logical Operators
Used to combine boolean values into expressions, ex: and, or ,not
If Statements
Conditional statements that gives us the ability to check conditions and change the behavior of the program accordingly.
Chained Conditionals
When there are more than two possibilities and we need more than two branches.
List
A sequence of values. Values in this are called elements.
Reference
The association of a variable with an object