Getting started with PythonPython 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.pywhere 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 scriptFirst 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
Running the scriptwhen you are in the correct folder simply run the following command
python helloworld.pyand you should see the text 'hello world' printed to the screen.