Introduction to Python and computer programming Flashcards
What is an instruction list?
A complete set of know commands (commands the computer recognises) is called an instruction list.
Different types/models of computers may have different instruction lists
What are the four elements of a language?
- Alphabet
- Lexis
- Syntax
- Semantics
What is an alphabet?
A set of symbols used to build words of a certain language
What is a lexis?
A set of words the language offers its users (a dictionary)
What is syntax?
A set of rules used to determine if a certain string of words form a valid sentence
What is semantics?
A set of rules determining if a certain phrase makes sense
The alphabet of machine learning is….
The instruction list
What is a source code?
A program written in a high-level programming language (python)
What is a source file?
The file containing the source code
How do we bridge the gap between computer and human language?
Machine language –> programming language (source code) –> natural language
What are the two methods of transforming a program from high level programming language to machine language?
Compilation and interpretation
What is compilation?
The source program (python) is translated once by getting a file containing the machine code the file can now be distributed world wide.
translated via a complier or translator
(every time the source code is modified the source program must be translated again)
What is interpretation?
The user can translate the source program each time it has to be run
The program performing transformation is called an interpreter
Source code is distributed WITH interpreter to end user
What does the interpreter do?
The interpreter reads the source code left to right, checks the lines are correct, then executes the code (or displays error)
Line by line (with some lines repeated e.g. functions)
Pros and cons of compilation?
Pros:
- execution of translated code is usually faster
- only the user needs to have the complier (end user can use code without it )
- the translated code is stored using machine learning (hard to read therefore inventions and programming tricks kept secret)
Cons:
- the compilation itself may be a very time-consuming process
- you have to have as many compliers as hardware platforms you want your code to be run on