Saving Your WorkΒΆ

The next big thing we want is to be able to save our program, edit it later and then run it any time without having to type it all in again. To do this, we need a text editor, so we can save and write our programs out to disk.

Get a text editor like Sublime Text Editor ( and then write your python and save it with a .py extension. You should then be able to double click it and have it run, or better yet, run it from your terminal (python3 <>). A more advanced (and free) text editor would be something like Vim ( it’s what I use normally, but it’s not for the faint of heart.

You could use something like Notepad on Windows, but you will find it’s much better to have an editor that knows a bit more about programming, it will highlight the program for you, and make everything much easier to work with.

Let’s try this!

Open your editor with a new file named and put in the file:

favoriteColor = "purple"
favoriteNumber = 12
print("My favorite color is", favoriteColor)
print("My favorite number is", favoriteNumber)

save this file, then go to your terminal, make sure you are in the same directory as the file you just saved ( and then type this:

on Mac OSX & Linux:


on Windows:


You should see something like:

zie@zoboFab ~/source/ $ python3
My favorite color is purple
My favorite number is 12