Words of the trade
To avoid ambiguity we need a common vocabulary and a structured framework for communication.
- An algorithm is writeable, unambiguous, completeable, and deterministic list of instructions, where
- Writeable means the description of the algortithm has finite length
- Unambiguous means the instructions are completely understandable
- Completeable means carrying out the instructions takes finite time
- Deterministic means whenever given the same inputs, the algorithms produces the same results.
- A program is an algorithm expressed in a programming language.
- In programming parlance, instructions are called statements.
- Synonyms for carrying out the instructions of a program are executing or running.
- Programming languages provide grammars (rules of structured communication) for producing syntactically correct (legal) code.
- Programming languages detail the specific actions to be taken (semantics) for each of its grammar rules.
- Style rules are (optional and legal) ways of writing code to support program reaability; e.g., snake_case.
- A program comment is an aside (explanation) to the reader. A comment is not program statement — there is no action associated with a comment other than to ignore it.
- A header comment identifies program user, purpose, and clarifications
- Whitespace is using horizontal or vertical spacing to separate different code elements; e.g., blank, tab, and indentation. Whitespace does not affect program interpretation.
- A compiler translates valid (i.e., syntactically correct) progamming language code (list of statements) from one language (source code) into another language (target code).
- An interpreter is a kind of compiler that carries out (executes) the statements as they are translated,
- A scripting language supports the automation of tasks in (special) run-time environments.
- A Python interpreter verifies that the entire code file is syntactically correct before execution begins.
- A Python program is a list of statements written in Python executed one-at-a-time from top-to-bottom.
- A Python single-line comment begins with a
# and continues for the rest of the line.
- A Python multi-line comment begins with a
''' and continues until another
''' is found.
- A literal is an explicit fundamental type value; e.g.,
- An identifier is a symbolic name for a value or predefined action. A variable names mut be an identifier; i.e., a letter followed by zero or more letters and numbers).
- In an identifer, lettercase matters; e.g.,
Email_ID are different identifiers. Most seriously suggest do not have two identifiers whose only difference is lettercase.
- A program action is written as an expression. An expression is evaluated to determine the value it represents. Expressions are ubiquitous in Python.
- An assignment statement evaluates the expression to the left of the assignment operator
= and assigns the variable to the right of the
= that value.
- The arithmetic operators are
** and perform respectively addition, subtraction, multiplication, decimal division, integer division, remainder (modulus), and exponentiation.
- The relational operators are
** and perform respectively less than, less than or equal to, greater than, greater than or equal to, equality, and inequality comparisons.
- The logical operators are
not and perform respectively logical and, logical or, and logical negation
- A function is a named block of code.
print() function produces output to the program user.
print() function is one of many built-in (predefined) functions to support frequent programming tasks.
- A function invocation causes its block of code to be executed.
- A function invocation consists of the function name, parentheses, and within the parentheses a list of zero or more comma-separated values (arguments); e.g,.
print( 'ai' )).