Glossary#
Syntax#
Syntax refers to how code is structured in a programming language.
For example, the syntax for creating a list
in Python is a comma-separated sequence of values enclosed by square brackets:
[1, 2, 3, 4, 5]
Built-in#
If something is built-in then it is either available by default, or can be accessed without installing any third-party software. In Python, there are various built-in functions such as print
or type
, as well as built-in libraries that can be imported without explictly installing them separately such as math
.
Libraries and packages#
A library or package is a collection of code that may be built-in or external to a given programming language. Libraries are usually written for a specific purpose e.g. the scipy
library contains various functions and constants that are helpful for scientific applications.
Function calls#
Whenever a line of code uses a function, this is referred to as a function call. For example:
import math
math.sin(math.pi / 2)
We would say that the second line above calls the math.sin
function.
Data structures#
A data structure is an object that allows us to store and retrieve data in an ordered or otherwise structured manner. Lists, tuples, dictionaries and numpy
arrays are all data structures that allow us to sort, order and index data in various different ways.
Elements and items#
Each value in an ordered sequence of any kind is referred to as an element or item. For example, in the tuple below:
(5, 10, 15, 20, 25)
\(10\) is the second element.
Indices#
An index is a integer that represents the position of a given item in an ordered sequence such as a list
. For example:
['a', 'b', 'c', 'd', 'e', 'f']
Here 'c'
is located at index \(2\). Remember that Python, and many other programming languages, start counting from zero, so 'a'
is at index \(0\), 'b'
at index \(1\) etc.