0%

Welcome to Python Land · practice

Meet the Python Playground

You have already run a few small examples inside the course. Now it’s time to meet the larger Python playground used for practice lessons.

This playground is where you’ll write, run, and improve your own programs. There is nothing to install. Python runs directly in your browser.

If the playground takes a moment to appear the first time, that’s normal. Python is getting ready for you.

Three things to notice

Depending on the size of your screen, the playground may appear beside this lesson or in a separate tab.

The editor

The editor is where you write Python code. It already contains two instructions for this lesson, so you don’t have to begin with an empty screen.

You can click anywhere in the editor and type just as you would in an ordinary text editor.

The output

When Python runs your code, its response appears in the output area. For this program, the output will be two lines of text.

Remember the distinction from the previous lesson:

  • The editor contains code.

  • The output area shows the result of running that code.

Run, the debugger, Reset, and Submit

The playground has three everyday controls and one debugger:

  • Run carries out all the code and shows you what happens.

  • The debugger replays the program one instruction at a time.

  • Reset restores the original starter code.

  • Submit checks whether your code completes the exercise.

Run is for seeing the complete result. The debugger is for slowing the program down so you can see how it reaches that result. Submit is for checking your finished work.

A submission that doesn’t pass is not the end of the exercise. Read the feedback, change your code, and try again.

What the controls reveal

Running the unchanged starter shows:

Hello from the playground!
This line is ready to change.

The debugger can then replay those two instructions. Next moves forward, Prev moves backward, and the highlighted line shows which instruction produced each piece of output. The Locals panel may be empty in this tiny program because it does not create any yet. In the next chapter, the same panel will show variables appearing and changing.

Reset restores the starter after an experiment, so you can change something, observe the result, and still get back to known code. A small safety net, but a comforting one.

Complete the exercise

Your actual task is to change the second instruction so the program produces this exact output:

Hello from the playground!
I changed the code.

You only need to replace the text between the quotation marks on the second line. Keep print(, the quotation marks, and the closing ) in place.

Press Run and compare the output carefully. When both lines match, press Submit.

Capital letters and punctuation matter in this exercise. That isn’t meant to trick you. Computers follow instructions very literally, and noticing small differences is a useful programming habit.

Monty can guide you

If you’re unsure where to click or what to change, ask Monty:

I’m completely new to code editors. Guide me through this exercise one step at a time, but let me type the answer myself.

You can also ask Monty to compare your output with the target. If something doesn’t match, Monty can help you spot the difference without taking over.

Monty is included for free throughout this opening chapter, so this is a good time to try asking a follow-up question.

Once your submission passes, you will have completed the full programming cycle for the first time: read, edit, run, inspect, and check.

Task

Change the second printed message so the program produces exactly:

Hello from the playground!
I changed the code.

Press Run to inspect the output, then press Submit when both lines match.

Before submitting, press Step once to open the debugger. Use Next to replay the two instructions, then use Prev or the slider to move backward. Notice that each output line appears only after its matching print() runs.