Python for Complete Beginners
A free beginner course for people who have never programmed. Ten short lessons take you from your first print() to a finished study-log program, and every lesson has code you run and check right in your browser. No installing, no setup.
10 lessons 3 hours of lessons 72 practice questions FreeEvery lesson, in order
Planned as 6 weeks at 4 sessions a week, about 30 minutes each. Each lesson opens here in full; in BiliMind your answers are marked and your flashcards come back before you forget them.
Python for Complete Beginners
Start here The finish lineYour first program
14 minRun a program, print text and numbers, and tell a string from a number.
- A program is a list of instructions Python follows from the top, in order.
- `print()` shows a value; `#` starts a comment Python ignores.
- The four everyday types are int, float, str and bool.
- Quotes make text: `"5"` is a string and `5` is a number, and they behave differently.
Variables and arithmetic
16 minName values with variables, calculate with the operators, and read input.
- A variable is a name for a value; `=` stores, it does not compare.
- `/` always returns a float, `//` drops the remainder, `%` keeps only the remainder.
- Brackets and the usual order of operations decide which part is calculated first.
- `input()` always returns a string: convert with `int()` or `float()` before doing sums.
Working with strings
17 minIndex, slice and clean text, build it with f-strings, and use the common string methods.
- Indexes start at 0, and negative indexes count from the end.
- `s[a:b]` includes `a` and excludes `b`.
- String methods return new strings: store the result if you want it.
- f-strings (`f"{value}"`) are the cleanest way to put values inside text.
Making decisions
18 minBranch with if, elif and else, combine tests with and/or/not, and put conditions in the right order.
- `if` runs a block only when its condition is true; `elif` and `else` handle the other cases.
- Python takes the first true branch and skips the rest, so the order of conditions matters.
- `==` compares and `=` stores; `and`, `or`, `not` combine tests.
- Always test the boundary values: the exact numbers where the rule changes.
Loops
18 minRepeat work with for and while, use range, and avoid off-by-one mistakes.
- `for` repeats once per item; `range(a, b)` runs from `a` up to but not including `b`.
- `while` repeats while a condition is true, so the body must move it towards false.
- The accumulator pattern (start, update in the loop, use after) covers sums, counts and lists.
- Off-by-one errors are the classic loop bug: test with 0 and 1 items.
Lists
18 minStore many values in order, change them, loop over them and build new lists.
- A list is an ordered collection in `[ ]`; indexes and slices work like strings.
- Lists can be changed: `append`, `insert`, `remove`, `pop`, and assigning by index.
- `sorted()` returns a new list; `.sort()` changes the original and returns `None`.
- A comprehension builds a new list in one line: `[f(x) for x in items if test(x)]`.
Dictionaries
18 minLook things up by key, count and group with dictionaries, and loop over them.
- A dictionary maps unique keys to values: `d[key]`, `d[key] = value`.
- Use `.get(key, default)` or `in` when the key may be missing.
- `.items()` loops over keys and values together.
- Counting with `d[k] = d.get(k, 0) + 1` is the idiom for frequencies.
Functions
18 minPackage code into reusable functions with parameters, defaults and return values.
- `def name(parameters):` defines a function and `return` hands back a value and ends it.
- A function with no `return` gives back `None`: print shows, return gives.
- Defaults make a parameter optional: `def f(a, b=10)`.
- Names created inside a function stay inside it.
Errors and files
18 minRead a traceback, handle failures with try/except, and read and write a text file.
- Read a traceback from the bottom: the error type, then the line number.
- Catch the specific error you expect with `try` / `except ValueError:`.
- Use `with open(...) as f:` so the file is closed for you; `"w"` replaces, `"r"` reads.
- In the browser, files live only for the run; on your own computer they are saved for real.
Put it all together: parse messy lines, total them with a dictionary, and print a clean report.
- Split a job into small functions that each do one thing and can be tested alone.
- Parse messy input at the edge, then work with clean values.
- A dictionary accumulates totals; sorting its items turns them into a report.
- Decide what to do with bad input (skip, default, stop) and write it down in the function.
01Do I need to install anything?
No. The code runs in your browser, so you can start on any device.
02Do I need to know maths or have coded before?
No. The course starts at zero and uses only everyday arithmetic.
03Is this Python 3?
Yes, current Python 3. Python 2 is long retired and not covered.
04How long does it take?
About 20 to 30 hours at an hour a day, so six weeks at four sessions a week is a comfortable pace.
05What can I do after it?
Build small tools for yourself, then go deeper into data work, web back ends or automation. Practice on your own projects matters most.
Study it properly, free
Start the course in BiliMind and it's yours: 72 questions marked as you go, 48 flashcards on spaced review, a plan around your week, and an assistant that can change any lesson.
Facts checked against: The Python Tutorial, Python built-in types.