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
- New file: File → New File (or
Cmd + Non Mac,Ctrl + Non Windows/Chromebook) - Save it: File → Save (or
Cmd + Son Mac,Ctrl + Son Windows/Chromebook) - Name it with
.py, likeachievement.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
| Problem | What’s happening | Fix |
|---|---|---|
| “It ran but nothing printed” | Your code doesn’t call print() | Add print(...) statements |
| “File not found” | Terminal is in a different folder | cd into the right folder (or use the full path) |
| Forgot to save | Terminal runs the old version | Save (File → Save) before running |
| AI changed too much | Hard to understand what happened | Revert, then ask for a smaller change |
Quick Reference
| Action | Menu | Mac | Windows/Chromebook |
|---|---|---|---|
| New file | File → New File | Cmd + N | Ctrl + N |
| Save | File → Save | Cmd + S | Ctrl + S |
| Terminal | View → Terminal | Cmd + ~ | Ctrl + ~ |
| Run code | (type in terminal) | python filename.py or python3 filename.py |