Python lessons: learn from scratch
There are two parts: question-and-answer pages and a sequence of lesson chapters. All of it is written by Nibras Code and available in 5 languages.
Questions and answers
- How do I start with Python? Install and first programInstalling Python, checking it in the terminal and the first print program.
- Variables and data types in PythonWhat a variable is, and what int, str, list and dict are for.
- if, for and while in Python: conditions and loopsMaking decisions with conditions and repeating work with loops.
- Python functions: def, parameters and returnHow to write and call a function.
- Python errors: what IndentationError, NameError and TypeError meanReading and fixing the most common errors.
- Where to start with Python? How long it takes and Python vs JavaScriptA plan for beginners, project ideas and choosing a language.
Lesson chapters
- First steps: your first Python programRun Hello World in the interpreter and from a file.
- Basics: literals, variables, stringsComments, numbers, strings, variables and program structure.
- Operators and expressionsArithmetic, comparison and logical operators, and precedence.
- Control flow: if, while, forConditions and loops, break and continue.
- FunctionsDefining functions, parameters, local variables, return and docstrings.
- Modulesimport, writing your own module, packages and pip.
- Data structures: list, tuple, dict, setLists, tuples, dictionaries, sets and sequences.
- Problem solving: a word counterTurn a real problem into a program, step by step.
- Object-oriented programmingClasses, objects, methods, __init__ and inheritance.
- Input and output: input, files, JSONRead user input, write to a file and read from it.
- Exceptions: try, except, finallyCatching errors, raise and the with statement.
- The standard librarysys, os, pathlib, datetime, random and logging.