CS 2316 Exam 1
Terms in this set (55)
A set of specific steps for solving a category of problems; A ﬁnite set of unambiguous instructions performed in a prescribed
sequence to achieve a goal.
A statement that assigns a value to a name (variable). To the left of the assignment operator, =, is a name. To the right of the assignment token is an expression which is evaluated by the Python interpreter and then assigned to the name. n = 1
A python statement that evaluates to either True or False. Typically
contains a comparison operator ( <, >, <=, >=, ==, !=) and may contain boolean operators such as AND, OR, or NOT.
Information in a program that is meant for other programmers (or anyone reading the source code) and has no effect on the execution of the program.
Compound Data Type
A data type in which the values are made up of components, or elements, that are themselves values.
To join two strings end-to-end.
A set of values. The type of a value determines how it can be used in expressions. So far, the types you have seen are integers (int), floating-point numbers (float), and strings (str).
The process of finding and removing any of the three kinds of programming errors.
decreasing a numerical variable by some number
To simplify an expression by performing the operations in order to yield a single value.
Raised by the runtime system if something goes wrong while the program is running.
A combination of variables, operators, and values that represents a single result value.
a Python data type that supports decimals in numbers
Flow of Execution
The order in which statements in a program are executed. Function calls, return statements, conditionals and loops all modify the standard top to bottom flow of execution.
A for loop is used to iterate through a sequence, or repeat a block of code a speciﬁc number of times
A named sequence of statements that performs some useful operation. Functions may or may not take parameters and may or may not produce a result.
The first part of a compound statement. A header line begins with a keyword and ends with a colon (:)
Immutable (data type)
A (compound) data type in which elements cannot be modified.
A statement which permits functions and variables defined in another Python module to be brought into the environment of another script. To use the features of the turtle, we need to first import the turtle module.
increasing a numerical variable by some number
Access a single character in a string /sequece using its position (starting from 0). Example: "This" evaluates to "i".
while loop will repeat a block of code as long as its' boolean expression evaluates to True
An object of a certain type, or class. tess and alex are different instances of the class Turtle.
A Python data type that holds positive and negative whole numbers.
The engine that executes your Python scripts or expressions.
To repeatedly execute a block of code.
A reserved word that is used by the compiler to parse program; you cannot use keywords like if, def, and while as variable names.
A variable defined inside a function. A local variable can only be used inside its function. Parameters of a function are also a special kind of local variable.
The construct that allows allows us to repeatedly execute a statement or a group of statements until a terminating condition is satisfied.
A variable used as part of a for loop. It is assigned a different value on each iteration of the loop.
A function that is attached to an object. Invoking or activating the method causes the object to respond in some way, e.g. forward is the method when we say tess.forward(100).
A file containing Python definitions and statements intended for use in other Python programs. The contents of a module are made available to the other program by using the import statement.
% operator, that calculates the remainder of an integer division.
Mutable (Data Type)
A data value which can be modified. The types of all mutable values are compound types. Lists and dictionaries are mutable; strings and tuples are not.
A loop inside the body of another loop.
default return statement of a function if your function does not return anything.
A compound data type that is often used to model a thing or concept in the real world. It bundles together the data and the operations that are relevant for that kind of data. Instance and object are used interchangeably.
A name used inside a function to refer to the value
passed as an argument.
To examine a program and analyze the syntactic structure.
A function used in a program or script that causes the Python interpreter to display a value on its output device.
An interactive user interface to the Python interpreter. The user of a Python shell types commands at the prompt (>>>), and presses the return key to send these commands immediately to the interpreter for processing. The word shell comes from Unix. In the PyScripter used in this RLE version of the book, the Interpreter Window is where we'd do the immediate mode interaction.
Return statements in many languages allow a function to specify a return value to be passed back to the code that called the function.
An error that does not occur until the program has started to execute but that prevents the program from continuing.; An error raised by the python runtime while the program is executing
if something goes wrong. For example, a divide by zero error.
A program stored in a file (usually one that will be interpreted).
An error in a program that makes it do something other than what the programmer intended.
A sub-sequence copied from a sequence specified by a range of indices. The slice operator is: sequence[start:stop}
An error in a program that makes it impossible to parse — and therefore impossible to interpret.
Deliberately changing the type of a value, using a function such as
int(), str(), or float().
A name that refers to a value.
A python data type that holds a string / sequence of characters.
A value provided to a function when the function is
called. This value is assigned to the corresponding parameter in the function.
A mutable compound data type that associates keys with values.
They map keys, which can be any immutable type, to values, which can be any
type, just like the values of a list or tuple.
One or more program statements that share the same level of indentation.
A statement that controls the flow of execution depending on some condition. In Python the keywords if, elif, and else are used for conditional statements.
A loop in which the terminating condition is never satisfied.