Coding Tutorials & Practice Examples

Short, beginner-friendly examples you can copy into the playground and run instantly. Reading code is good — running and changing it is better.

JavaScript Practice Questions

Try these in the playground with the JavaScript language selected:

  1. Reverse a string without using .reverse().
  2. Check whether a number is prime.
  3. Find the largest number in an array.
  4. Count the vowels in a sentence.
  5. Print the FizzBuzz sequence from 1 to 50.

Example solution for FizzBuzz:

for (let i = 1; i <= 50; i++) {
  let out = "";
  if (i % 3 === 0) out += "Fizz";
  if (i % 5 === 0) out += "Buzz";
  console.log(out || i);
}

Python Examples

Switch the language selector to Python and experiment:

  1. Sum every even number between 1 and 100.
  2. Build a list of squares with a list comprehension.
  3. Count word frequency in a string.
  4. Generate the Fibonacci sequence.
def fib(n):
    a, b = 0, 1
    for _ in range(n):
        print(a, end=" ")
        a, b = b, a + b

fib(10)

SQL Practice

Open the SQL practice section — it ships with five sample tables (employees, students, orders, products, departments) and a real SQLite engine. Try these:

-- All employees in the IT department
SELECT name, salary FROM employees
WHERE department = 'IT';

-- Average salary per department
SELECT department, ROUND(AVG(salary)) AS avg_salary
FROM employees
GROUP BY department;

MySQL Tutorial Basics

The query language you practise here is standard SQL, which is the same foundation MySQL uses. The core clauses to learn first:

Every query above runs unchanged in MySQL. When you are comfortable, move the same statements into a real MySQL server with confidence.