Cursor

What It Is

Cursor is a code editor (like VS Code) with built-in AI features. In this course, you’ll use Cursor to write Python programs, run them in the terminal, and get help understanding errors and improving your code.

Why We Use It

Cursor helps beginners because it gives you:

  • A clean place to write code (with syntax highlighting and autocomplete)
  • A built-in terminal so you can run Python without switching apps
  • AI help for explaining code, debugging errors, and suggesting improvements

Think of it like having a practice facility + film room + assistant coach in one place.

How to Use It

Create and Save a Python File

  1. New file: File → New File (or Cmd + N on Mac, Ctrl + N on Windows/Chromebook)
  2. Save it: File → Save (or Cmd + S on Mac, Ctrl + S on Windows/Chromebook)
  3. Name it with .py, like achievement.py

Open the Terminal

Use View > Terminal from the menu bar, or use a keyboard shortcut:

  • Mac: Cmd + ~
  • Windows/Chromebook: Ctrl + ~

In the terminal, you can run:

python achievement.py

If that doesn’t work, try:

python3 achievement.py

Use AI Help (Safely)

Good ways to use AI in this class:

  • Ask: “Explain what this line does”
  • Ask: “Why am I getting this error?”
  • Ask: “Show me a simpler version of this code”

When AI suggests code:

  • Read it before you run it
  • Run it in small steps
  • Keep the code yours (you should be able to explain what it does)

If you ask AI to change your code (especially if it suggests changing a lot), keep it simple:

  • Get the plan first: “Tell me your plan before you change anything.”
  • You approve edits: “Don’t edit files until I say ‘yes’.”
  • Small win only: “Change one small thing, then stop so I can check it.”
  • Explain it fast: “What did you change, and why?”
  • Run your code after each small change so you can spot problems right away.

Copy/paste prompts:

  • “Plan first. Ask before you edit any files.”
  • “Only change 5–10 lines (or one function), then wait.”
  • “Show the exact lines you changed (before and after).”

Common Pitfalls

ProblemWhat’s happeningFix
“It ran but nothing printed”Your code doesn’t call print()Add print(...) statements
“File not found”Terminal is in a different foldercd into the right folder (or use the full path)
Forgot to saveTerminal runs the old versionSave (File → Save) before running
AI changed too muchHard to understand what happenedRevert, then ask for a smaller change

Quick Reference

ActionMenuMacWindows/Chromebook
New fileFile → New FileCmd + NCtrl + N
SaveFile → SaveCmd + SCtrl + S
TerminalView → TerminalCmd + ~Ctrl + ~
Run code(type in terminal)python filename.py or python3 filename.py