Instead of printing “Hello, world!” from the command line, let’s save it in a file. Then every time we call the file using python “Hello, world!” will print to your screen.
1. Open a terminal window.
vim hello.py. This creates a file called hello.py in the current directory and opens it for editing in the vi improved editor.
i to enter Insert mode.
print "Hello, world!"
5. Press the Esc button to exit Insert mode
:wq to save your changes and quit the editor
ls and you should see hello.py listed as one of the files
8. To run the program, type
9. Press enter and you should see Hello, world! printed on your screen