Getting started with Python
Edit, save, and rerun
Change your script, save it, rerun it, and check the result.
Lesson 5 of 63
Reading: about 2 min
Lesson + practice: about 6 min
Difficulty: Beginner
On this page3 sections
Programming often follows a short cycle: edit the code, save the file, run it, and check the result. You can repeat this cycle as many times as needed.
Try the cycle
Replace one existing print() line in hello.py with a personal message, such as the line below. Keep your other lines in the file. Save it, run the same command you used earlier, and confirm that the new message appears.
print("I changed this message!")I changed this message!
Why this works
Python runs the version of the file currently saved on disk. Editing in the editor without saving leaves the old file in place. Compare the output with a specific prediction after each edit; that makes an unnoticed mistake easier to spot.
What are the four steps of the basic programming cycle?
Reveal answer
Edit, save, run, and check the result.
Try another case
You changed the message in the editor, but the terminal still prints the old message. What two checks come first?
Check your answer
Reveal answer
Save the edit, then confirm the terminal runs the hello.py file from the folder you edited.
Your progress
Reveal the check answer or reach the end to complete this lesson.