Pybites Logo Rust Platform

Exercises

Code Editor

Using the built-in code editor and its features

On this page

Code Editor

The platform includes a built-in code editor powered by CodeMirror with Rust syntax highlighting. You write, edit, and submit your code directly in the browser.

Editor Layout

Code editor

The exercise page is split into two panels:

  • Left panel — exercise description with instructions, examples, and tips
  • Right panel — the code editor with your Rust code

Both panels are scrollable and resize for different screen sizes.

Editor Features

  • Syntax highlighting — Rust keywords, types, strings, and comments are color-coded
  • Dark mode — the editor theme switches automatically when you toggle dark mode
  • Code persistence — your latest code is saved automatically as a submission
  • Copy button — click the copy icon in the top-right corner to copy the code to your clipboard

Starter Code

Each exercise loads with starter code that includes:

  • A function signature you need to implement
  • Test cases at the bottom that verify your solution

The starter code gives you the structure. Your job is to fill in the implementation.

Running Tests

Click the Run Tests button below the editor to submit your code. The platform:

  1. Sends your code to the Rust compiler and test runner
  2. Returns the results: pass or fail, plus compiler output

Test feedback

Results appear below the editor in a terminal-style output. On success, you'll see a green header. On failure, you'll see a red header with compiler errors or test failures to help you debug.

Tips

  • Read the full exercise description before writing code
  • Pay attention to the test cases — they show expected inputs and outputs
  • Use the compiler feedback to fix issues iteratively
  • After solving, check the Solution tab to see the model answer