2902 exercises

Coding Exercises for Beginners

Exercises for HTML, CSS, JavaScript, Python, Java, C++, PHP, SQL, Git and GitHub, with instant feedback, hints and full solutions. Pick a language, or try today's challenge.

Four ways to practise

We mix exercise types because each one trains a different skill: recall, reading code, writing code and debugging.

Multiple choice

Pick the right answer and read why.

Fill in the blanks

Type the missing piece of real code.

Predict the output

Guess what prints, then run it to check.

Fix the bug

Broken code + automatic tests. Make them pass.

Want something bigger?

Projects combine everything into one real build.

Browse projects Daily challenge

How coding exercises help you learn faster

Reading a lesson gives you the idea. Practice turns that idea into something you can use without looking it up. Research on learning keeps finding the same thing: people remember far more when they have to recall an answer than when they simply re-read it. That's why every lesson on Codevra ends with exercises, and why this page collects all of them in one place for each language.

The exercises are short on purpose. Most take one to three minutes, so you can fit a few into a coffee break. Small, frequent practice beats one long session at the weekend, because each time you return to a topic, your memory of it gets a little stronger.

The exercise types and what each one trains

Multiple choice checks that you understand the concept. After you answer, you see an explanation of why the right answer is right and why the others are wrong. Reading those explanations is often where the real learning happens.

Fill in the blanks asks you to type the missing part of a working piece of code, such as a property name, a keyword or an operator. It builds the muscle memory you need to write code without constantly checking the syntax.

Predict the output shows you a short program and asks what it will print. This trains the most underrated skill in programming: reading code and running it in your head. Developers spend far more time reading code than writing it.

Fix the bug gives you code that doesn't work and automatic tests that tell you when it does. Debugging is a daily part of every programming job, and practising it on small, focused examples makes real bugs much less scary.

Exercises for every language

Each course has its own exercise page grouped by lesson, so you can practise one topic at a time or work through the whole course in order. Web exercises, such as the HTML exercises, run right in the page. Exercises for languages that need a server or compiler, such as Python, Java, SQL and C++, focus on reading, predicting and completing code, with the expected output shown so you can check your thinking.

Every exercise is marked easy, medium or hard. If you're new to a topic, do the easy ones first. If you can answer them quickly, move straight to the harder ones.

A simple routine that works

  1. Read the lesson, including the examples and the common mistakes section.
  2. Do the easy exercises straight away while the topic is fresh.
  3. Come back the next day and try the medium and hard ones without re-reading the lesson.
  4. Note anything you got wrong and revisit that part of the lesson.
  5. Take the course quiz once you've finished a stage, then build a project that uses what you learned.

If you'd rather have a mix chosen for you, the daily challenge picks one lesson, one exercise, one bug to fix and a short quiz each day.

Exercises, quizzes or projects?

Each kind of practice does a different job. Exercises focus on one small skill at a time and give instant feedback, so they're best right after a lesson. Quizzes test understanding across a whole course and are useful as checkpoints at the end of a stage. Projects combine many skills into one working result and show you how the pieces fit together. A healthy mix is to do exercises daily, take a quiz every week or two, and build a project whenever you finish a stage of a course.

What to do when you're stuck

Use the hint first. Hints point you in the right direction without giving the answer away. If you're still stuck, open the solution, read it carefully, then close it and type the answer yourself from memory. Copying a solution teaches very little, but rebuilding it from understanding teaches a lot. Finally, go back to the lesson and find the example closest to the exercise. Most exercises are built directly on one of the examples, so the answer is usually only a small step away. And remember that being stuck is normal. Every developer spends part of each day not knowing the answer yet; the skill is in working calmly towards it.