AP CSP Pseudocode Runner
Run code written in the AP CSP exam reference sheet language. Step through it line by line, watch the variables, and convert it to Python. Runs in your browser, free, no sign-up.
Output
Variables
Robot grid The triangle is the robot, the star is the goal, dark squares are walls.
How to use the AP CSP pseudocode runner
- Type or paste AP CSP pseudocode in the editor, or pick an example. Type
<-for←. - Press Run (or Ctrl+Enter) to run the whole program. DISPLAY output appears below the editor.
- Press Step to run one statement at a time: the current line is highlighted and the Variables table shows every value.
- When the program reaches
INPUT (), type a value in the box under the output and press Enter. - Press Convert to Python to see the same program in Python and open it in the Python compiler.
Practice with exam-style questions
Every code question in the AP CSP practice test has a Run this code button that opens it here, so you can check your answer by running it.
To practice writing code, try the 25 AP CSP coding exercises: each one checks your program with tests.
Frequently asked questions
How do I type the arrow ←?
Type < followed by -: the editor turns it into ←. You can also use != for ≠, <= for ≤ and >= for ≥.
Why does my list start at 1?
In AP CSP pseudocode the first element of a list is at index 1, and an index outside 1 to LENGTH (aList) stops the program with an error. Python lists start at 0, so Convert to Python subtracts 1 from each index.
What does DISPLAY show?
DISPLAY (expression) shows the value followed by a space, so several DISPLAY calls appear on the same line, as on the exam.
How does INPUT () work?
When the program reaches INPUT (), a box appears under the output. Type a value and press Enter. Numbers are read as numbers, true and false as Boolean values, anything else as text.
Does the code run on a server?
No. The runner is a JavaScript interpreter that runs in your browser, so it works offline once the page has loaded and nothing you type is sent anywhere.
AP is a trademark registered by the College Board, which is not affiliated with, and does not endorse, this site.