Python Basics
Python Basics
Section titled โPython BasicsโThis page is a compact orientation to the language. It does not replace the chapter-style pages, but it gives you the right mental model before you go deeper.
What Makes Python Feel Different
Section titled โWhat Makes Python Feel DifferentโCompared with many other mainstream languages, Python emphasizes:
- readability over punctuation-heavy syntax
- indentation as part of block structure
- quick iteration in scripts, shells, and notebooks
- a standard library that covers common tasks out of the box
Core Syntax You Meet First
Section titled โCore Syntax You Meet FirstโVariables and values
Section titled โVariables and valuesโname = "Ava"count = 3price = 19.99active = TruePython variables are names bound to objects. You do not declare the type ahead of time.
Collections
Section titled โCollectionsโnumbers = [1, 2, 3]point = (10, 20)user = {"name": "Ava", "role": "admin"}tags = {"python", "api", "automation"}Conditionals and loops
Section titled โConditionals and loopsโif count > 0: print("positive")else: print("zero or negative")
for number in numbers: print(number)Functions
Section titled โFunctionsโdef greet(name: str) -> str: return f"Hello, {name}"Python Habits Worth Learning Early
Section titled โPython Habits Worth Learning Earlyโ- use virtual environments per project
- prefer
python -m pipwhen you want the interpreter and package manager to match - keep scripts small and focused
- name things clearly instead of over-compressing the code
- add type hints when they improve clarity
The Topics That Matter Next
Section titled โThe Topics That Matter NextโOnce you understand the basics, the next useful layers are:
- data structures
- functions and modules
- exceptions and file handling
- classes and object design
- packaging, environments, and tooling