Term
|
Definition
the arrangement of words and phrases to create well-formed sentences in a language |
|
|
Term
|
Definition
the part that can be ascertained at compile time, including data typing, whether all variable are declared, which declaration applies to which variable in the case of scoping, what their type is, whether functions and methods are called with correct calling sequences, whether assignments |
|
|
Term
|
Definition
iterals include the string, unicode string, integer, float, long, list, tuple and dictionary types. |
|
|
Term
|
Definition
|
|
Term
|
Definition
is the field concerned with the rigorous mathematical study of the meaning of programming languages. It does so by evaluating the meaning of syntactically legal strings defined by a specific programming language, showing the computation involved. |
|
|
Term
|
Definition
-
a text listing of commands to be compiled or assembled into an executable computer program.
|
|
|
Term
|
Definition
-
a computer programming language consisting of binary or hexadecimal instructions that a computer can respond to directly.
|
|
|
Term
|
Definition
a list of commands that can be executed without user interaction. |
|
|
Term
|
Definition
is a sequence of definitions and commands. These definitions are evaluated and the commands are executed by the interpreter in something called the shell.
|
|
|
Term
|
Definition
Typically, a new shell is created whenever execution of a program begins. In most cases, a window is associated with the shell.
|
|
|
Term
|
Definition
Often called a statement, instructs the intpreter to do something.
example: The statement print 'Yankees rule!' instructs the interpreter to output the string Yankees rule! to the window associated with the shell.
|
|
|
Term
|
Definition
The core things that Python programs manipulate.
Every object has a Type that defines the kinds of things that programs can do with objects of that type.
|
|
|
Term
|
Definition
defines the kinds of things that programs can do with objects of that type.
Types are either scalar or non-scalar.
|
|
|
Term
|
Definition
objects that are indivisible. Think of them as the atoms of the language. Non-scalar objects, for example strings, have internal structure.
There are four types of Scalar Objects:
int, float, bool, none
|
|
|
Term
|
Definition
Operators and Objects can be combined to form expressions.
Every expression evaluates to an object of some Type referred to as the Value of the expression. |
|
|
Term
|
Definition
an expression evaluated to an object of some Type. |
|
|
Term
|
Definition
used to test whether two expressions evaluate to the same value.
|
|
|
Term
|
Definition
used to test whether two expressions evaluate to different values.
|
|
|
Term
|
Definition
is a shell prompt indicating that the interpreter is expecting the user to type some Python code into the shell.
|
|
|
Term
|
Definition
the sum of I and j. If I and j are both of type int,the result is an int. If either of them is a float, the result is a float. |
|
|
Term
|
Definition
I minus j. If I and j are both of type int, the result is an int. If either of them is a float, the result is a float. |
|
|
Term
|
Definition
the product of I and j. If I and j are both of type int, the result is an int. If either of them is a float, the result is a float. |
|
|
Term
|
Definition
integer division. For example, the value of 6//2 is the int 3 and the value of 6//4 is the int 1. The value is 1 because integer division returns the quotient and ignores the remainder.
|
|
|
Term
|
Definition
i divided by j. In Python 2.7, when i and j are both of type int, the result is also an int, otherwise the result is a float. In this book, we will never use / to divide one int by another. We will use // to do that. (In Python 3, the / operator, thank goodness, always returns a float. For example, in Python 3 the value of 6/4 is 1.5.)
|
|
|
Term
|
Definition
he remainder when the int i is divided by the int j. It is typically pronounced “i mod j,” which is short for “i modulo j.”
|
|
|
Term
|
Definition
I raised to the power j. If I and j are both of type int, the result is an int. If either of them is a float, the result is a float.
|
|
|
Term
|
Definition
== (equal),
!= (not equal),
> (greater),
>= (at least),
<, (less)
<= (at most)
|
|
|
Term
|
Definition
|
|
Term
|
Definition
in Python, just a name nothing more |
|
|
Term
|
Definition
A statement associating the variable or name to the left side of = symbol and the object to the right side of the = symbol.
(An object can have one, more than one, or no name associated with it.) |
|
|
Term
(Python) rules of variable names: |
|
Definition
case-sensitive. Use digits (but they cannot start with a digit), and use the special character _
|
|
|
Term
|
Definition
Also called keywords
have built-in meanings and cannot be used as variable names. Different versions of Python have slightly different lists of reserved words. The reserved words in Python 2.7 are:
and, as, assert, break, class, continue, def, del, elif, else, except, exec, finally, for, from, global, if, import, in, is, lambda, not, or, pass, print, raise, return, try, with, while, and yield.
|
|
|
Term
|
Definition
Enhance the readability of code. (To start a comment use #) |
|
|
Term
|
Definition
Execute one statement after another in the order that they appear, and stop when they run out of statements. |
|
|
Term
|
Definition
The simplest branching statement consisting of three parts
- a test, i.e., an expression that evaluates to either True or False;
- A block of code that is executed if the test evaluates to True;
- an optional block of code that is executed if the test evaluates to False.
|
|
|
Term
Example of Boolean Expression: |
|
Definition
-
Conditional statement where any expression that evaluates to True or False can follow the reserved word if and a block of code indicates that any sequence of Python statements can follow else
-
if x%2 == 0:
-
print 'Even'
-
else:
-
print 'Odd'
-
print 'Done with conditional'
-
|
|
|
Term
|
Definition
semantically meaningful in Python. For example, if the last statement in the below code were indented it would be part of the block of code associated with the else, rather than with the block of code following the conditional statement.
if x%2 == 0:
print 'Even'
else:
print 'Odd'
print 'Done with conditional'
|
|
|
Term
|
Definition
When either the true block or the false block of a conditional contains another conditional
f x%2 == 0:
if x%3 == 0:
print 'Divisible by 2 and 3'
else:
print 'Divisible by 2 and not by 3'
elif x%3 == 0:
print 'Divisible by 3 and not by 2'
|
|
|
Term
|
Definition
a boolean conditional statement that executes if the conditional expression in the if statement resolves to 0 or a FALSE value. (Stands for: else if) |
|
|
Term
Compound Boolean Expressions example:
|
|
Definition
if x < y and x < z:
print 'x is least'
elif y < z: print 'y is least'
else: print 'z is least'
|
|
|