Python skills you should keep practicing to become a good coder, first part

A good coder has not achieved all their computer programming skills overnight, nothing happens without hard work and dedication. Having some experience with the Python computer programming language, it took me some years to truly realize that software development is not about just reading syntax or computer programming books, but about practicing and building stuff that works.

Although there are many skilled coders out there, whom one thinks that they can not match in terms of skills, I do believe that patience is a key factor in becoming a top notch computer programmer.

For one to master any craft, it is necessarily for them to practice it everyday, without stopping. Being smart is always a good thing, especially when it comes to writing and maintaining computer code, but consistency is the king if one wants to move their computer programming skills to the next level. Continue reading “Python skills you should keep practicing to become a good coder, first part”

How to write and raise an a very simple custom exception in Python

Having gained some experience with the Python computer programming language, I truly know how important it is for the Python geek to learn and practice the exception handling so they can handle errors better in their applications and projects.

From my experience with research on the Internet about the Python computer programming language, coders face a lot of struggle when it comes to building their custom exceptions, especially the complete beginners. With the main purpose of introducing the Python beginner to the base builtin exception class and preparing them to write their own customs exceptions, I decided to share this short tutorial.

First of all, one important thing everyone of the readers should know about before going any further, is that all the different exceptions in the Python computer programming language are generated from the one shown below. Continue reading “How to write and raise an a very simple custom exception in Python”

How to trace your Python program with pdb

There are many useful Python packages to the Python coder out there. One of them is pdb, a package which can help to trace the state of a program in the Python computer programming language with the main purpose of debugging the code of an application or a project.

The purpose of this very short tutorial is to give the beginner a simple introduction to the builtin python debugger, through an example.

Before going any further with the article, make sure to write the following Python function in a new file, exactly like shown below.
Continue reading “How to trace your Python program with pdb”

A simple example of the try/except Python statements

There is so much confusion being created on the Internet geek communities when it comes to the try/except statements in the Python computer programming language, especially among the complete beginners who have no idea at all about error handling practices.

Having struggled myself with the try/except statements during the beginning of my Python coding journey, I decided to share a simple example which can be a benefit to a lot of people who are interested in learning the Python computer programming language. The sample code being shared through this tutorial, has not practical usage in real world scenarios, but for sure it is a great source to use when stuck in a try/except piece of Python code. Continue reading “A simple example of the try/except Python statements”

How to remove an item with the del statement in Python

When the Python coders work in the interactive console, or when they write scripts to be executed later in time, most of the time they make use of the del statement with the main purpose of removing an object. Beginners in the coding journey, need clear instructions so they can truly understand what a specific builtin utility achieves by being used in the Python computer programming language.

During this very short tutorial, codetheory will instruct the reader on the Python statement called del. According to the official documentation, the Python del statement can be used to remove entire variables. The syntax for it is being shown below. Continue reading “How to remove an item with the del statement in Python”

How to install a Python package with pip

Being an open source computer programming language, Python offers the opportunity to everyone out there to contribute their source code to the community, so people can benefit from the software packages of each other.

Based on my personal experience with the Python computer programming language so far, there are many packages out there which one can install to develop their software. And as far as my knowledge goes about the Python computer technology, there are many different ways to install a package in it.

A very practical way which can help the Python coder install packages on their machine, widely used by professional developers, is through pip. Continue reading “How to install a Python package with pip”

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.

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.