1. Data
All languages support number, string, and boolean data types. Other data types can be built on top of or by composing these data types (for example, into classes).2. Operations
All languages support basic arithmetical (+, -, *, /) and boolean (and, or, not) operations.3. Commands
All languages provide commands such as:- Assignments of data to memory locations (variables)
- Input and output to various devices (screen, printer, etc.)
- Conditional statements to make decisions
- Loops and iterations to perform the same task repetitively
Any computer language that supports the above facility is Turing complete meaning the language can perform any computation that is possible with any other computing language.
Complex data types
Complex data types are built from primitive data types.
Tuple
- An immutable, ordered sequence of elements.
- (1, 3, 5)
- Strings is an immutable ordered sequence of characters.
List
- A mutable, ordered sequence of heterogeneous elements.
- [1, "astring", ["another", "list", "within"]]
Dictionaries
- A mutable, un-ordered container for key-value pairs
- Generalizes indexing - keys are hashed, and a value can be looked up by providing a key
- {'Chicago': 'Illinois', 'Sacramento': 'California', 'jack': 800}