Declarative Knowledge
A statement of fact
it does not tell you have to do stuff
Imperative Knowledge
A recipe or “how-to”
(this tells you how to do something)
Also know as an algorithm
What is a recipe?
1) A sequence of simple steps
2) Flow of control that specifies when each step is executed
3) Determining when to stop
Syntax
Is passing of a sentence/string
Static semantics
Is which syntactically valid strings have meaning
Semantics
Is the meaning associated with syntactically correct string of symbols with no static semantic errors
Program
Is a sequence of definitions and commands
Commands
Statements - instruct interpreter to do something
Data objects
is what the program is manipulating
Objects are
scalar (cannot be subdivided)
non-scalar (have internal structure that can be accessed)
Object type
defines what the programs can do to them
Scalar objects in Python
cast
convert objects of one type to another
combine objects and operators
operator precedence without parentheses
** * / \+ and - execute left to right parentheses always have top priority and get done first and will be evaluated inside out.
assignment
equal sign is an assignment of a value to a variable name
Abstracting expressions
Branching
Variables (bindings)
String
overloaded the + operator
is when using the + sign to concatenate two or more strings together
for loops
while loops
compare/test object type
- isinstance(object, type) testing if an object is of a certain type