Interactive Learning

    Master Modern Engineering

    Hands-on coding challenges to sharpen your skills in real-time.

    Domain:
    AI & Machine Learning

    01. Prompt Engineering Technique: Few-Shot

    Beginner

    In the editor below, you'll find a template. Your task is to craft a few-shot prompt that converts informal slang into professional business English. Provide at least 2 examples in the prompt.

    AI & Machine Learning
    PRACTICE
    Web Development

    01. Variables & Data Types

    Beginner

    Declare a constant 'username' with your name and a let variable 'score' initialized to 0. Log both.

    Web Development
    PRACTICE
    Web Development

    02. Conditionals & Logic

    Beginner

    Create an 'age' variable. Write an if/else statement that logs 'Welcome' if age is 18 or older, and 'Access Denied' otherwise.

    Web Development
    PRACTICE
    AI & Machine Learning

    02. Crafting Effective Prompts: Context & Constraints

    Beginner

    Create a prompt for an AI that acts as a Front-end UI/UX Critic. Ask it to review a landing page description. Constraints: Tone must be 'constructive but firm', and the output must be a bulleted list of exactly 3 points.

    AI & Machine Learning
    PRACTICE
    Web Development

    03. Functions & Scope

    Beginner

    Write a function 'calculateTotal' that takes 'price' and 'quantity' as arguments and returns the total. Log the result for (25, 4).

    Web Development
    PRACTICE
    AI & Machine Learning

    03. Prompt Engineering Patterns: Chain-of-Thought

    Intermediate

    Craft a Chain-of-Thought prompt for a logical puzzle. The AI must first state the known facts, then the intermediate steps, and finally the conclusion.

    AI & Machine Learning
    PRACTICE
    Web Development

    04. Array Transformation

    Intermediate

    Given an array of numbers [2, 4, 6, 8], use .map() to create a new array where each number is squared. Log the result.

    Web Development
    PRACTICE
    AI & Machine Learning

    04. Integrating the GenAI SDK

    Advanced

    We will use the official Google GenAI SDK to interact directly with an LLM from our browser sandbox. **Step 1.** Import `GoogleGenAI` from `https://esm.sh/@google/genai`. **Step 2.** Initialize the client: `const ai = new GoogleGenAI({ apiKey: 'YOUR_GEMINI_API_KEY' })`. **Step 3.** Use `ai.models.generateContent` with the model `gemini-2.5-flash` to ask: "Explain APIs to a 5-year-old in one sentence." **Step 4.** Log `response.text` to the console.

    AI & Machine Learning
    PRACTICE
    AI & Machine Learning

    04. Projects for Practice: Building a Code Assistant

    Advanced

    Write a complete System Prompt for an AI bot called 'Tailwind-GPT'. It should only answer questions about Tailwind CSS. If asked about other CSS frameworks, it must politely decline. It should provide code snippets for all answers.

    AI & Machine Learning
    PRACTICE
    Web Development

    05. Loops & Iteration

    Beginner

    Write a 'for' loop that logs the numbers from 5 down to 1 (countdown).

    Web Development
    PRACTICE
    AI & Machine Learning

    05. Maintaining Conversation History

    Advanced

    AI models are stateless; they don't remember previous messages unless you send the entire history every time. Let's use the SDK's built-in chat session manager. **Step 1.** Initialize `GoogleGenAI`. **Step 2.** Create a chat session using `ai.chats.create({ model: 'gemini-2.5-flash' })`. **Step 3.** Send a message: `"I have 5 apples."` and log the response text. **Step 4.** Send another message: `"I ate 2 of them. How many do I have left?"` and log the response.

    AI & Machine Learning
    PRACTICE
    Web Development

    06. Capstone: Simple Calculator

    Intermediate

    Create an object 'calculator' with a method 'operate' that takes (a, b, operation). Support 'add' and 'multiply'. Log the result of (10, 5, 'add').

    Web Development
    PRACTICE
    AI & Machine Learning

    06. Structured JSON Outputs

    Advanced

    When building applications, you often need the AI to return parsable data (like JSON) instead of raw conversational text. **Step 1.** Ask the AI to generate details for a famous sci-fi movie (Title, Director, Year). **Step 2.** Pass the `config: { responseMimeType: 'application/json' }` option alongside the model and contents. **Step 3.** Log the result. Try doing `JSON.parse(response.text)` to prove it's valid data!

    AI & Machine Learning
    PRACTICE
    AI & Machine Learning

    07. System Instructions & Persona

    Advanced

    System instructions dictate the fundamental rules of behavior for the AI across an entire session. **Step 1.** Draft a system instruction that tells the AI it is a "Pirate Coding Assistant" who must speak entirely in pirate slang, but still provide accurate JavaScript answers. **Step 2.** Use `ai.models.generateContent` and pass your system instruction into the `config.systemInstruction` field. **Step 3.** Ask it: "How do I declare a variable in JavaScript?" and log the results.

    AI & Machine Learning
    PRACTICE