Introduction
Python is a high-level, general-purpose programming language created by Guido van Rossum and first released in 1991. It is famous for its clean, readable syntax and is one of the most widely tested languages in IT-officer, BCS (technical), and bank IT written exams. Questions typically test the output of a small code snippet, the meaning of an operator, the difference between data structures, and core concepts such as dynamic typing and indentation. This lesson builds Python from first principles so that you can predict the output of any exam snippet with confidence.
Python is an interpreted language: source code is executed line-by-line by the Python interpreter (CPython), rather than being compiled ahead of time to machine code. It is dynamically typed (you do not declare variable types) and strongly typed (it will not silently mix incompatible types, e.g. "5" + 3 raises an error).
Learning objectives
- Explain what Python is, its key features, and how the interpreter runs code.
- Use Python's built-in data types and know which are mutable and immutable.
- Apply all operator categories, especially
//,%,**,==vsis,and/or/not. - Index and slice strings, lists, and tuples correctly.
- Choose correctly between list, tuple, set, and dict.
- Write and trace control flow (
if/elif/else,for,while,break,continue,pass). - Define functions with default,
*args,**kwargs,lambda, and understand LEGB scope. - Use comprehensions, exception handling, and basic OOP.
- Predict the exact printed output of a code snippet.