Skip to content

Using the Editor ​

A guide for students on how to use the code editor.

Interface Overview ​

The editor has two main areas:

  • Code Tab — Where you write your Python code
  • Output Tab — Where you see results when you run your code

Writing Code ​

The Editor ​

The code editor provides:

  • Syntax highlighting — Python keywords, strings, and comments are color-coded
  • Line numbers — Helpful for finding errors
  • Auto-indent — Press Enter and the cursor indents automatically
  • Tab support — Press Tab for 4 spaces of indentation

Starter Code ​

Some assignments come with starter code already filled in. This might include:

  • Function definitions you need to complete
  • Comments explaining what to do
  • Test code to check your work

TIP

Don't delete the starter code! Complete the # TODO sections.

Running Your Code ​

Click "Run Code" ​

  1. Write your Python code in the editor
  2. Click the Run Code button (blue)
  3. The Output tab opens automatically
  4. See your program's output

Using input() ​

If your code uses input():

  1. A text field appears in the output area
  2. Type your response
  3. Press Enter to continue

Example:

python
name = input("What is your name? ")
print(f"Hello, {name}!")

When you run this:

  1. You'll see "What is your name?" in the output
  2. Type your name in the input field
  3. Press Enter
  4. See "Hello, [your name]!"

Understanding Errors ​

Syntax Errors ​

If your code has a syntax error (like a missing parenthesis), you'll see:

SyntaxError: unexpected EOF while parsing

Fix: Check for missing parentheses, quotes, or colons.

Runtime Errors ​

If your code runs but crashes, you'll see the error type and line number:

NameError: name 'pritn' is not defined

Fix: Check for typos in variable or function names.

Common Errors ​

ErrorCauseFix
SyntaxErrorMissing :, ), or "Check your punctuation
NameErrorTypo in variable nameCheck spelling
TypeErrorWrong type (e.g., "5" + 5)Convert types properly
IndentationErrorWrong indentationUse consistent spaces

Submitting Your Code ​

Before Submitting ​

  1. Test your code — Click "Run Code" first
  2. Check for errors — Fix any red error messages
  3. Verify output — Make sure it matches what's expected

Click "Submit Code" ​

  1. Click the Submit Code button (green)
  2. Wait for "Submitting..." to complete
  3. See "Submitted successfully" with a link

View Your Results ​

Click "View on Gradescope" to see:

  • Your submission
  • Autograder results
  • Your score

Tips for Success ​

Test Before Submitting ​

Always run your code locally first. It's faster than waiting for Gradescope.

Read Error Messages ​

Error messages tell you:

  • What went wrong
  • Which line has the problem

Start Simple ​

If your code isn't working:

  1. Comment out most of your code
  2. Test one small piece
  3. Add more code gradually

Use Print Statements ​

Add print() statements to see what your variables contain:

python
x = calculate_something()
print(f"x = {x}")  # Debug: see what x is

Keyboard Shortcuts ​

ShortcutAction
TabInsert 4 spaces
Shift+TabRemove indentation
Ctrl/Cmd+ZUndo
Ctrl/Cmd+Shift+ZRedo
Ctrl/Cmd+/Comment/uncomment line

Getting Help ​

Click the ? button in the bottom bar to see the help modal with quick tips.

Released under the MIT License.