CodePlay ?

CodePlay

Guide

Run, Stop and Reset

Run sends your code to real Python inside this browser; nothing leaves the device. Stop ends a run that is taking too long, and a run that goes on for a few seconds stops by itself. Reset puts the starting code back. Running often is a good habit: change one thing, run, look.

Errors

Errors show Pythonโ€™s own message, because that is what you will see everywhere else, with plain words beside it. The red line in the editor is where Python noticed the problem; the real mistake is often on that line or the one just above.

Goals and tests

Each activity has a goal list. After a run every item shows โœ“ or โœ—. Tests call your function with an input and compare what comes back with the expected value. Run also checks a few extra cases, such as zero or an empty list.

Hints

Hints open one at a time: first the idea, then a case to try by hand, then a plan in words. After the last hint you can ask to see one solution. Hints are kept in your record so you can see what helped; they never take anything away.

Your records

Progress and your code are saved in this browser only. Save a backup in Settings before clearing browser data.

Kinds of activity

๐Ÿ”ฎ Predict

Read the code and pick what you think will happen before running it. Guessing wrong is fine: that is how you find what to look at. After you answer, press Run to watch.

๐Ÿงฉ Parsons

Tap the lines to put them in your program. Use โ†‘ โ†“ to change the order and โ‡ค โ‡ฅ to change the indent: indented lines belong to the line above that ends in a colon. One line may not be needed. Then press Run.

๐Ÿ‘ฃ Trace

Press Next to run one line at a time. The highlighted line is the one about to run; the table shows every variable at that moment. Step until you can answer the question.

๐Ÿ”ง Modify

The code almost works. Change as little as you can, press Run, and check the goal list: every item needs a โœ“.

๐Ÿž Debug

This code has bugs. Run it first and watch what goes wrong, then fix it. Error messages keep Pythonโ€™s own words, with a plain explanation next to them.

โœ๏ธ Write

Finish the function so every test passes. The listed tests show the idea; Run also checks a few more cases, such as small or empty inputs.