Python Basics: Arithmetic, Imports, Sequences, Lists, and Dictionaries
Summary
This introductory tutorial explains basic Python operations and container types for readers with no programming background. It demonstrates arithmetic and importing a module, then distinguishes sequences—such as lists, tuples, and strings—from dictionaries, which map keys to values. Examples show indexing, slicing, negative indices, membership checks, and combining sequences. The tutorial also covers list conversion, element replacement and deletion, insertion, appending, searching, removal, and sorting, along with creating a dictionary from named values.
The material is intended as a first orientation for people interested in Python’s role in quantitative work, rather than a guide to trading systems or research methods. Its examples are small and focused on syntax; it does not discuss market data, numerical libraries, strategy design, or backtesting. Some examples reflect older Python conventions, so readers may need to adapt them to current Python versions. The article ends by pointing toward functions, loops, conditions, and classes as topics for further study.
Key ideas
- Python can perform basic arithmetic and import modules to access their functions.
- Lists, tuples, and strings are ordered sequences that support indexing and slicing.
- Lists can be changed, while tuples are presented as immutable sequences.
- Dictionaries store key-value mappings and are accessed by key rather than position.
- Common list methods support adding, locating, removing, and sorting elements.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.