Starting with the basics.

Understanding more about Python and learning about somehow this language works, I decided to build a really simple program that will help me with basic functions and that way develop my programming skills.

Let’s start explaining about the class Ppsn in my program. I was looking for a tool that can verify the ppsn from the users and validate it if the ppsn is in pattern with the Irish Personal Public Service Number. That wasn’t a big challenge, but I didn’t find one library that can help me with it.

I found one library that will help me with some tasks in my program, but the function Ppsn verification wasn’t working, and I did it by myself. I will explain more about the library below.

The library name is Python-stdnum 1.17. It is a great tool that can help to verify, validate, format and more. The library works with a large of personal and company documents numbers around the world, check the link and have a look at Arthur’s works.

Link to the PyPI website:

Before starting with the code, I needed to do some research about how the ppsn works. That part was easy because if you access the citzensinformation web site, you will see all detail you need to understand it.

Citizens information link:

Back to my program. As I mentioned before, I needed to verify the ppsn of the users and I created a specific class that will help me. Ppsn class has two specific functions. The first one is the __init__, my initializer method that contains the instruction in turn there is a sequence to execute, in my program will do some treatments and execute the PPS validation method. Another method is called PPS validation. This part will get the number provided and will verify, if it will be in the pattern as the quantities of number, letters and if the sequence is right.

I didn’t go too deep in the validation because it is a simple program, and I was more interested to practice other methods and functions. Check below how is the Ppsn part.

After the first part is done, I would like to introduce one more function into my program to verify Iban numbers. I used Arthur’s library to validate and format the Iban number and after including this new function, I reformat the program to organize and make it more understandable.

When you add a new function into your program, you need to rearrange the code, optimize what you are coding and make your code clean and understandable. We can call this Factory method.

I created a static method that will guide the input of the user through the number of characters that were typed, into the two different classes, the PPSN that I explained before, and the new one IbanNumber that I introduced now.

IBAN number class has the responsibility to receive these numbers and letters and verify is valid or not, I checked what has behind the Iban numbers and basically, It can contain between 15 and 32 numbers, it depends on which country the Iban come from and others specific rules, that is one of the great examples that library saves your time and keep your code clean and organized.

You can have a look

However, I wrote one more specific task on my program, just to use and see how efficient the libraries are, what I did is, after the program validate the information, it can format the number and show to the user the Iban with a specific format. In the end, the program will show the Iban splinted with spaces.




My name is Renato. I would like to show you how to be a Data Scientist with no background in the area.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Resiliency Options in Azure — Part 1

My Experience About Lets Grow More

JSP Shell

Craft CMS Vs WordPress: Why Choose Craft? — Galaxy Weblinks

Automatically generating up-to-date database diagrams with TypeORM

A Web Developer’s Take on Flutter

Your Online Business Fundamentals

Why You Should Stop Setting Goals And Start Building Systems Instead

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Step by Step

Step by Step

My name is Renato. I would like to show you how to be a Data Scientist with no background in the area.

More from Medium

Pair Programming: A beginners perspective

Pair programming

Understanding List Comprehensions in Python

Understanding Regex in Depth with Examples Part 1

The Way of Python — Basics of data types and operators