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:
- Reverse a string without using
.reverse(). - Check whether a number is prime.
- Find the largest number in an array.
- Count the vowels in a sentence.
- 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:
- Sum every even number between 1 and 100.
- Build a list of squares with a list comprehension.
- Count word frequency in a string.
- 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:
SELECT— choose which columns to return.WHERE— filter rows by a condition.ORDER BY— sort the result set.GROUP BYwithCOUNT,SUM,AVG— summarise data.JOIN— combine rows from two tables.
Every query above runs unchanged in MySQL. When you are comfortable, move the same statements into a real MySQL server with confidence.