Glossary Flashcards
algorithm
A general, mechanical process for solving a category of problems.
bug
An error in a program.
byte code
An intermediate language between source code and object code. Many modern languages first compile source code into byte code and then interpret the byte code with a program called a virtual machine.
compile
To translate a program written in a high-level language into a low-level language all at once, in preparation for later execution.
debugging
The process of finding and removing any of the three kinds of programming errors.
executable
Another name for object code that is ready to be executed.
formal language
languages designed for specific purposes, such as representing mathematical ideas or computer programs; all programming languages are formal languages.
high-level language
A programming language like Python that is designed to be easy for humans to read and write.
interpret
To execute a program in a high-level language by translating it one line at a time.
low-level language
A programming language that is designed to be easy for a computer to execute; also called machine language or assembly language.
natural language
Any one of the languages that people speak that evolved naturally.
object code
The output of the compiler after it translates the program.
parse
To examine a program and analyze the syntactic structure.
portability
A property of a program that can run on more than one kind of computer.
print statement
An instruction that causes the Python interpreter to display a value on the screen.
problem solving
The process of formulating a problem, finding a solution, and expressing the solution.
program
a sequence of instructions that specifies to a computer actions and computations to be performed.
Python shell
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.
runtime error
An error that does not occur until the program has started to execute but that prevents the program from continuing.
script
A program stored in a file (usually one that will be interpreted).
semantic error
An error in a program that makes it do something other than what the programmer intended.
semantics
The meaning of a program.
source code
A program in a high-level language before being compiled.
syntax
The structure of a program.
syntax error
An error in a program that makes it impossible to parse — and therefore impossible to interpret.
token
One of the basic elements of the syntactic structure of a program, analogous to a word in a natural language.
assignment operator
= is Python’s assignment operator, which should not be confused with the mathematical comparison operator using the same symbol.
assignment statement
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 operator is an expression
comment
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.
composition
The ability to combine simple expressions and statements into compound statements and expressions in order to represent complex computations concisely. Also refers to building functions by calling other functions
composition
The ability to combine simple expressions and statements into compound statements and expressions in order to represent complex computations concisely.
concatenate
To join two strings end-to-end.
data type
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 (type int), floating-point numbers (type float), and strings (type str).
evaluate
To simplify an expression by performing the operations in order to yield a single value.
expression
A combination of variables, operators, and values that represents a single result value.
float
A Python data type which stores floating-point numbers. Floating-point numbers are stored internally in two parts: a base and an exponent. When printed in the standard format, they look like decimal numbers. Beware of rounding errors when you use floats, and remember that they are only approximate values.
int
A Python data type that holds positive and negative whole numbers.
integer division
An operation that divides one integer by another and yields an integer. Integer division yields only the whole number of times that the numerator is divisible by the denominator and discards any remainder.
keyword
A reserved word that is used by the compiler to parse program; you cannot use keywords like if, def, and while as variable names.
operand
One of the values on which an operator operates.
operator
A special symbol that represents a simple computation like addition, multiplication, or string concatenation.
rules of precedence
The set of rules governing the order in which expressions involving multiple operators and operands are evaluated.
state diagram
A graphical representation of a set of variables and the values to which they refer.
statement
An instruction that the Python interpreter can execute. Examples of statements include the assignment statement and the print statement.
str
A Python data type that holds a string of characters.
value
A number or string (or other things to be named later) that can be stored in a variable or computed in an expression.
variable
A name that refers to a value.
variable name
A name given to a variable. Variable names in Python consist of a sequence of letters (a..z, A..Z, and _) and digits (0..9) that begins with a letter. In best programming practice, variable names should be chosen so that they describe their use in the program, making the program self documenting.
attribute
state or value that belongs to a particular object. for example, slim (turtle) has a color.
canvas
a surface within a window where drawing takes place
for loop
a statement in python for convenient repetition of statements in the body of the loop
instance
an object that belongs to a class. slim and cujo are instances of the the class Turtle in the module turtle
invoke
an object has methods. the verb invoke means to activate a method. Invoking a method is done by adding parentheses after the method name and perhaps passing arguments; e.g. window.exitonclick() is an invocation of the exitonclick method
iteration
basic building blocks for algorithms. allows steps to be repeated. sometimes called looping. repeated execution of a sequence of statements
loop body
statements nested (indented) inside of a loop
loop variable
variable used as part of the for loop. it is assigned a different value for each iteration of the loop and is used as part of the terminating condition
method
a function attached to an object. invoking the method causes the object to respond in some way; e.g. move the turtle forward with slim.forward(50)
module
a file containing definitions and statements for use in other Python programs. the contents of a module are made available to the program using the import statement
object
a “thing” to which a variable can refer; e.g. slim = turtle.Turtle(). slim is object (and variable?!)
range
built-in function for generating sequences of integers. especially useful for a loop that needs to be generated a specific number of times (with the for loop)
sequential
the default behavior of a program; line-by-line processing of the algorithm
state
the collection of attribute values that a specific data object maintains
state
the collection of attribute values that a specific data object maintains
terminating condition
condition that, when it occurs, causes a loop to stop repeating its body; e.g. the for loop stops executing when there are no more elements to assign to the loop variable
Turtle
a data object used to create pictures (called turtle graphics)
deterministic
a process that is repeatable and predictable
documentation
a place where you can go to get information about the programming language
pseudo-random number
a number that is not genuinely random but is generated algorithmically
standard library
a collection of modules included in the normal Python installation
function
a named sequence of statements that belong together
compound statement
header line and body…the for statement and functions
chatterbox function
A function which interacts with the user (using input or print) when it should not. Silent functions that just convert their input arguments into their output results are usually the most useful ones
composition (of functions)
calling one function from within the body of another or using the return value of one function as the argument to the call for another
dead code
part of the program that never gets executed, often because it appears after the return statement
fruitful function
a function that yields a return value instead of None
incremental development
A program development plan intended to simplify debugging by adding and testing only a small amount of code at a time
None
A special Python value. One use in Python is that it is returned by functions that do not execute a return statement with a return argument
return value
the value provided as a result of a function call
scaffolding
code that is used during program development to assist with development and debugging. doctests is one example
temporary variable
a variable used to store an intermediate value in a complex calculation. created via an assignment statement in a function
function call
also referred to as function invocation. name of the function followed by the arguments (assigned to parameters in the function definition).
lifetime
the time during which a local variable exists
local scope
the range of statements within a function that represent where the local variables can be accessed
global scope
the range of statements globally that represent where the local variables can be accessed
shadowing
when a local variable shares the same name as a global variable. Python cannot access the global variable because the local variable will be found first
scope
range of statements in the code where the variables can be accessed
accumulator pattern
the action of incrementing a variable through an interation
accumulator
the variable that is modified in an accumulator pattern loop
functional decomposition
the action of taking a problem and breaking it apart into smaller subproblem
generalization
problem-solving technique: see pattern and relationship to simplify a solution: a square is just a type of rectangle
block
a groups of consecutive statements with the same indentation
body
the block of statements in a compound statement that follows the header
boolean expression
an expression that is either True or False
boolean function
a function that returns True or False. The only possible values of the bool type are False and True.
boolean value
There are exactly two boolean values: True and False. Boolean values result when a boolean expression is evaluated by the Python interpreter. They have type bool.
branch
one of the possible paths of the flow of execution determined by the conditional execution
chained conditional
a condition branch with more than two possible flows of execution. In Python, chained conditionals are written with if….elif….else statements
comparison operator
one of the operators that compare two values: ==, >=,
condition
the boolean expression in a conditional statement that determines which branch is executed
conditional statement
a statement that controls the execution depending on some condition. In Python the keywords if, elif and else are used for conditional statements.
logical operators
one of the operators that combines two boolean expressions: and or not
modulus operator
an operator, denoted with the percent sign (%) that works on integers and yields the remainder of one number divided by another
nesting
one program structure within another; such as a conditional statement inside the branch of another conditional
Boolean Algebra
The basis of all computer mathematics. Created by George Boole
another name for conditional statement
selection statement
another name for if statement
binary statement (only True / False)
unary selection
omitting the else clause in the if compound statement
algorithm
a step-by-step process for solving a category of problems
body
statements inside of a compound statement, like a loop
counter
a variable used to count something, usually initialized to zero and incremented in the body of a loop
cursor
an invisible marker that keeps track of where the next character will be written
definitive iteration
a loop for which an upper bound for the iteration of the body is known. usually coded with a for loop
escape sequence
the escape character, \, followed by a printable character that denotes a non-printable character
generalize
to replace a constant with a variable or parameter. Generalization makes code more versatile, more likely to be re-used and, sometimes, easier to write.
infinite loop
a loop whose terminating condition is never satisfied
indefinite loop
a loop whose upper bound is not pre-determined. coded with a while loop
iteration
repeated executions of the body of the loop
loop
a set of statements that is repeated until the terminating condition is reached
loop variable
a variable used as part of a loop as part of the terminating condition
nested loop
a loop inside the body of a loop
newline
an escape character that moves the cursor to a new line
reassignment
making more than one assignment to a variable in the course of the program
tab
an escape character that moves the cursor to the next tab stop
collection data type
a data type in which the values are made up of components, or elements, that are themselves values (str)
default value
the value given to an optional parameter if no argument is passed to it during the function call
dot notation
use of the dot to access functions inside modules or to access methods and attributes of objects
immutable
a compound data type whose elements cannot be assigned new values
index
a variable or value used to select a member of an ordered collection, such as a character from a string or an element from a list
optional parameter
a parameter in the function header which is assigned a value that will be used if no other value is passed to it via an argument in the function call
slice
part of a string (substring) specified by a range of indices. More generally, any subsequence of any sequence type in Python can be created using the slice operators
traverse
to iterate through the elements of a collection, performing a similar operation on each
whitespace
any of the characters that move the cursor without printing visible characters. The constant string.whitespace contains all the white-space characters
string (collection definition)
sequential collection of characters
lexicographical order
similar to alphabetical order, but all uppercase letters come before lowercase letters
ordinal value
unique identifier number for characters in Python
iteration by item
sequence iteration where the loop variable is automatically reassigned to each character in the string
id
Unique identifier for objects corresponding to an address in memory
aliases
multiple variables that contain references to the same object
clone
to create a new object that has the same value as an existing object. Copying a reference to an object creates an alias but doesn’t clone the object
delimiter
a character or string used to indicate where the string should be split
element
one of the values in a list (or sequence). The bracket operator selects element of a list.
index
an integer, variable or value that indicates an element of a list (or char in a str)
list
a collection of objects, where each object is identified by an index. Like other types (str, int, float), there is a list type-converter function that tries to turn its argument into a list.
list traversal
the sequential accessing of each element in a list
modifier
a function which changes its arguments inside the function body. Only mutable types can be changed by modifiers.
mutable data type
a data type in which the elements may be modified. All mutable types are compound types. Lists is a mutable data type; string is not.
nested list
a list that is an element of another list
object
a thing to which a variable can refer
pattern
a sequence of statements, or a style of coding something that has general applicability in a number of different situations. Part of becoming a mature Computer Scientist is to learn and establish the algorithms that form your toolkit. Patterns often correspond to your “mental chunking.”
pure function
a function which has no side effects. Pure function only change the calling function through their return value
sequence
any of the data types that consist of an ordered collection of elements, with each element identified by an index
side effect
a change in the state of a program made by calling a function that is not a result of reading the return value from the function. Side effects can only be produced by modifiers.
tuple
a sequential collection of items, similar to a list. Any python object can be an element of a tuple. However, unlike a list, tuples are immutable
item assignment
assignment to an element of a list
functional programming style
using pure functions wherever possible and modifiers where appropriate
dictionary
collection of key-value pairs that maps from keys to values. keys can be any immutable type and values can be any type
key
a data item mapped to a value in the dictionary. keys are used to look up a value in a dictionary.
key-value pair
one of the pair of items in a dictionary. values are looked up in a dictionary by key
mapping type
a data type composed of a collection of keys with associated values. dictionaries are python’s only built-in mapping type and use the associative array abstract data type
abstract data type
a mathematical model for data types where a data type is defined by its behavior (semantics) from the point of view of a user of the data, specifically in terms of possible values, possible operations on data of this type, and the behavior of these operations
attribute
one of the named data items that makes up an instance
class
user-defined compound type. can be thought of as a template for the objects that are instances of it
constructor
every class has a factory, called by the same name as the class, for making new instances. If the class has an “initializer method” this method is used to set the attributes to their initial states
initializer method
a special method named __init__ that is automatically invoked to set a newly-created object’s attributes to their initial state
instance
an object whose type is some type of class. Object and instance are used interchangeably
instantiate
to create an instance of a class and run its initializer method
method
a function that is defined inside a class definition and is invoked on instances of the class
object (from class)
a compound data type that is often used to model a thing or concept in the real world. It bundles together the data and operations that are relevant for that kind of data.
object-oriented programming
a powerful programming paradigm in which data and the operations that manipulate it are organized into classes and methods