CodeLab Practice

Last updated: 2026-07-06

What is CodeLab?

CodeLab is an in-browser coding environment that lets you write and run Python or JavaScript code without installing any software. CodeLab uses the Piston API to execute code in a secure sandbox environment.

Accessing CodeLab

Access CodeLab at https://app.hamicodeviet.com/codelab. You must be logged in to use it.

Supported Languages

LanguageVersionDescription
Python3.xPrimary language for beginners
JavaScriptNode.jsPopular web language

Writing and Running Code

  1. Select a language (Python or JavaScript)
  2. Write your code in the editor
  3. Click the Run button to execute
  4. Results will appear in the panel below
  5. Enter input data (stdin) if needed

Python Example

# Print a greeting
print("Hello, HaMi Code Việt!")

# Sum from 1 to 10
total = sum(range(1, 11))
print("Sum from 1 to 10 is: " + str(total))

# For loop
for i in range(5):
    print("Iteration " + str(i + 1))

JavaScript Example

// Print a greeting
console.log("Hello, HaMi Code Việt!");

// Sum from 1 to 10
let total = 0;
for (let n = 1; n <= 10; n++) total += n;
console.log("Sum from 1 to 10 is: " + total);

// For loop
for (let i = 0; i < 5; i++) {
  console.log("Iteration " + (i + 1));
}

Practice Exercises

Each exercise in CodeLab includes:

How Piston Works

CodeLab uses Piston — an open-source code execution service. When you click Run:

  1. Your code is sent to the Piston API
  2. Piston runs the code in a secure sandbox container
  3. Results (stdout, stderr) are returned
  4. The system compares output against expected results
  5. Pass/fail status is shown for each test case
Execution limits

Each run is limited to 10 seconds. Code that runs too long will be terminated. File system and network access are not available from within code.

Security

Your code runs in a fully isolated sandbox environment. Piston ensures:

In the future, HaMi Code Việt will deploy a private Piston instance to enhance privacy and reliability for grading.

Submission History

All your submissions are saved and can be reviewed. Go to the CodeLab page and select the History tab to view previous submissions.