Getting started with Python

Python can run either as an interactive prompt or can be run by passing in a script filename as the first argument. This means that we can pass in a file like this
python script.py
where script.py can be any filename.

All Python script files must use the .py extension, however the name of the file can be anything.

Testing our first script

First we need to make sure we can run a test script - it is beyond the scope of this blog post to explain how Python works. First create a file called helloworld.py and make the contents of that file the following code
print("hello world")
This is probably the simplest program that can be written in Python and simply prints the text "hello world" to the console before exiting. When we have created and saved the file simply navigate to the folder using the command prompt (sometimes called terminal depending on your operating system). You can do this by using the commands 'cd ' (where is the name of the folder you wish to move into) or 'cd ..' to move up a directory. You can use the command 'ls' to see the contents of the current folder you are in.

Running the script

when you are in the correct folder simply run the following command
python helloworld.py
and you should see the text 'hello world' printed to the screen.