How to execute a Python script, for complete beginners

When one starts their journey with the Python computer programming language, there are many questions they ask themselves, most of which require an experienced geek to answer them. Frustration is a normal thing to experience during the journey as a coder, especially in the beginning, when one has no idea at all what they’re doing.

Being a Python geek myself, I must admit that the beginning of the journey with the Python computer programming language was not easy, especially when it came to practicing stuff in the interactive console.

During this short tutorial, I will teach the complete beginner how they can execute a Python script in their machine, without any kind of frustration or pain.

What's the one thing every developer wants? More screens! Enhance your coding experience with an external monitor to increase screen real estate.

First of all, let’s define what is a script in the Python computer programming language. According to my knowledge on the Python computer programming technology, any file which ends in the .py extension, is considered to be a script.

For example, the following file is considered to be a script in terms of the Python computer programming language.

test.py

As far as my knowledge on the Python computer technology goes, a script acts as package for a group of statements with the main purpose of executing them together. Based on my experience with the Python technology, scripts can range from simple arithmetic operations, to complex stuff such as custom functions and classes.

For one to execute a script in Python computer programming language, they need to make sure they can access the Python interpreter from the console first.

Then, one can easily execute a Python script like shown below.

python test.py

From the above example, one can easily understand that python is the interpreter, and test.py is the script which is going to get executed.

Final thoughts

Depending on what the script contains, the results will be displayed on the console offered by the operating system which one is using while they’re executing and running the Python script.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download

Leave a Reply

Your email address will not be published. Required fields are marked *