Python
- High level programming language
- Programming language is a way of giving instructions to a computer
- A computer can only do one thing at a time; hence instructions need
to be given in a sequence
- All these instructions together form an algorithm
- Python is an interpreted language- it can operate in two modes,
interactive mode and script mode
- Interactive for testing and debugging small codes, script for running
larger codes.
Algorithm: Sequence of instructions to solve a specific problem
Low level language High level language
Machine code (binary) Human based language
No conversion needed since the Needs translators to convert to low
computer already understands level language understood by the
machine language (code will computer
execute faster).
Much more difficult to read and Easier to understand as keywords
understand, prone to errors used are closely aligned with
everyday use
Very specific to the computer that Portable programs as the language
the program is written for is abstracted away from the
underlying computer and CPU
Only supports primitive data types Support a wider range of data
understood by the computer types, giving the functionality
where users can define their own
data type.
Interpreter:
A translator which will convert only one line of code at a time. After it
converts each line it sends it straight to the CPU
- Slow, as the interpreter is constantly working between code and
CPU
- Work on multiple platforms, as the translator will translate for the
CPU that is present
- Let us debug code as we can watch the code run line by line and
see errors
Compiler:
A compiler converts all of the high-level code into machine code before it
is run.
- The CPU can run the machine code directly and does not need any
interaction with a translator.
- Much quicker
- Specific to a platform- doesn’t work across platforms