Free · No account · Runs in your browser
Actually learn
to code.
AI can write code. Someone still has to understand it. Short lessons, a real editor on every page and exercises that check your work. You type every line, so it ends up in your head and not just in a chat window.
51 lessons · 103 checked exercises · Python, JavaScript, HTML/CSS, SQL and C
const name = "your name";
for (let i = 3; i > 0; i--) {
console.log(i + "...");
}
console.log("Hi " + name + ", you just ran code.");
Pick a track
Each one is 12 to 14 short lessons, beginner to early intermediate. Do them in order or jump around; nobody is grading you except the checker.
The pitch
Why learn it yourself when a chatbot can write it?
Because someone has to spot the bug
AI writes code that looks right and is quietly wrong. If you cannot read it, you cannot tell. Learning the basics is how you stop being the person who pastes and prays.
Typing is how it sticks
Reading a solution feels like learning. It mostly is not. Your fingers making the mistake, then fixing it, is what builds the mental model. So the exercises start nearly empty.
Errors are the curriculum
Every red message in the output is a lesson nobody had to write. You will see a lot of them here, on purpose, with hints that nudge instead of spoil.
Then use AI, properly
Once you understand the code, AI turns into a fast assistant instead of a crutch. You ask better questions and you know when the answer is nonsense. That is the goal.
How a lesson works
- 1
Read one idea
150 to 300 words. Plain language, no padding, one concept per page.
- 2
Run the example
It is a real editor. Change things and see what breaks. Breaking things is allowed.
- 3
Solve the exercise
Press Check. The site runs your code and tells you if it works. Hints if you are stuck.
Python runs on real CPython, C is compiled for real, SQL is real SQLite. All of it in your browser, nothing on our servers.
Then build something
Small projects that make you glue the ideas together. One per track below; more on the projects page, and bigger Pro projects are on the way.
Number guesser
The computer picks a number, you guess, it says higher or lower. Loops, if/else and input() in one tiny game.
- Pick a secret number with
random.randint(1, 100). - Read guesses from
input()in a while loop. - Print "higher" or "lower" until the guess is right, then print how many tries it took.
Bill splitter
Two inputs, one button, one answer. Read values from a form, do some maths, show the result on the page.
- Make inputs for the bill total and the number of people.
- On click, read both values with
Number(input.value). - Show each person's share with two decimals using
toFixed(2).
Playlist stats
Answer real questions about a playlist: top artists, total minutes, the longest song. GROUP BY gets a workout.
- Count songs per artist and sort by the count.
- Find the total playlist length in minutes.
- Find the longest song with
ORDER BYandLIMIT.
Bit printer
Print any number in binary using shifts and masks. Once you can see the bits, overflow stops being magic.
- Write
void print_bits(unsigned char x). - Loop from bit 7 down to 0 and print
(x >> i) & 1. - Print 5, 255 and what 255 + 1 becomes in an unsigned char.
Ten minutes is enough to start
Lesson 1 of every track is short, and you write real code in it. No setup, no sign-up, nothing to install.
Questions people ask
Is it actually free?
Yes. All lessons, exercises and playgrounds are free and stay free. Later we will add bigger Pro projects, which is how the free part pays for itself.
Do I need an account?
No. Your progress and your code are saved in this browser. Clear your browser data and it is gone, so that is the trade-off.
Do I need to install anything?
No. Python runs on real CPython compiled to WebAssembly, C is compiled by a real C compiler, and SQL is real SQLite, all inside your browser tab. Nothing to download or set up.
Does it work on a phone?
Yes, the lessons and editor work on phones. A laptop is nicer for longer code, because curly brackets on a phone keyboard are a crime.
Which language should I start with?
Python if you have never coded. HTML/CSS + JavaScript if you want to make websites. SQL if you like data. C if you want to know what the computer is really doing.
Can I use this for school or a coding class?
Yes. Every lesson is one idea with a runnable example and checked exercises, so it works for homework, revision or a quick in-class demo. Share the lesson link; there is nothing to sign up for.
What is Brainlag?
brainlag.space is a free site for students with study tools, guides and games. This is the coding corner of it.