Basics for Pythons
Basics are the first building blocks of Python: variables, numbers, strings and booleans, plus the control flow that decides what runs. Variables are names bound to objects, types are checked at runtime, and if, for and while statements use indentation instead of braces to show structure.
Stage: Fundamentals · Part of the Python roadmap · Last reviewed 19 November 2026
What to learn in Basics
- Assign variables and check types with type and isinstance
- Format strings with f-strings and common string methods
- Branch with if, elif and else using comparison and logical operators
- Repeat work using for loops with range and while loops
- Read user input and convert it between types
Basics interview questions
What is the difference between a list and a tuple in Python's loops and use?
A list is mutable, so you can add, remove and change items, while a tuple is immutable. Tuples suit fixed records and can be dictionary keys when their items are hashable. Both can be iterated with a for loop.
Why does indentation matter in Python?
Python uses indentation to mark blocks such as the body of an if, loop or function, instead of braces. Inconsistent indentation causes an IndentationError or, worse, changes which lines belong to a block. Use four spaces consistently.
Where Basics fits in the Python roadmap
Basics belongs to the Fundamentals stage (beginner level), which takes about 28 hours. Core syntax.
Other units in this stage
Back to the full Python roadmap