IT 116: Introduction to Scripting
Key Concepts
Concepts
Interpreter
Statement
Function
Function Call
Argument
Data Type
Variable
Assignment Statement
File
Directory
Folder
Interpreter
A program that that turns a scripting language like Python
The interpreter reads each line in the program starting at the top
It the Python code into machine language that the CPU understands
Then it runs the machine language code
Statement
A statement is one or more lines of code ...
that performs a complete action
It is like a Python sentence
The interpreter runs though a Python script statement by statement ...
translating each into machine language
Function
A function is a group of Python statements ...
that has a name ...
and does something useful
A function is a package of Python statements
Function Call
A function call is a statement that runs a function
It consists of the name of the function ...
followed by parentheses,
( )
...
which usually contain values called arguments
Here is the format
FUNCTION_NAME([ARGUMENT, ...])
Some functions take no argument
But the function name
MUST
be followed by
( )
Argument
An argument is a value given to a function when it is called
Arguments appear within the parentheses of a function call ...
separated by commas
Data Type
Computers deal with different types of values
For example, the arguments in functions can be
Integers
Decimals
Words
Each of these values must be handled differently by the machine
So they are represent in different formats in memory
Each of these formats is called a data type
Each of the value types above is a different data type
int: Integer
float: Decimal
str: String
String
A string is a collect of characters
The characters of a string are stored in memory as binary numbers
We need a table of characters and the numbers that represent them
The table we use is called Unicode
Python uses the UTF-8 encoding to represent characters
Variable
A variable is a word of memory that has a name ...
and holds a
single
value
A variable can hold a value of
any
data type
And you can change the data type of the value at any time
Assignment Statement
An assignment statement is a statement that give a value to a variable
You create a variable by using an assignment statement to give it it's first value
Here is the format
VARIABLE_NAME = VALUE
File
A file is linear arrangement of data on some storage device
Linear means it is one dimensional
It has a beginning and an end
Files live on hardware like
Hard drives
Thumb drives
SSD drives
CDs
Directory
A directory is a container that holds files and other directories
It is used to organize data on an electronic device
Directories are sometimes called folders