Python: a test script

The tutor offers a quick way to test the Python installation.

If you’re running Linux, I’d guess Python is on-board. With Windows, Python likely needs to be installed. In either case, to test it, you can write a test script, then attempt to run it.

In a text editor (Notepad in Windows, or perhaps gedit in Linux), this one-line script could be written:

print(“Hello. This is a test.”)

Let’s imagine the file is saved as test.py; now you’d like to try running it. Here’s how, from the command line:

python test.py    (Linux)

test.py   (Windows)

If the script works, you’ll hopefully see the greeting

Hello. This is a test.

I hope it works:)

Source:

Donaldson, Toby. Python. Peachpit Press, 2014.

Jack of Oracle Tutoring by Jack and Diane, Campbell River, BC.

Leave a Reply