In this article I will introduce you to exception handling. In the previous articles in this series we use exception handling to cover some rare exception cases (remember the Guess the Number game?) and now it is time to explain how to do it in your own application -- and when to do it.Read More
Python is available for various platforms which includes Linux, Windows and Mac OS. So here we are going to understand how to setup python environment. For the local environment setup open the terminal window and type there “python” to know that it is already installed or not, if installed then which version.Read More
As in Python it is not necessary to create our code into classes while developing program as we can use functions also which is known as Procedural Programming. However, a procedural programming is used for writing small, short and simple programs whereas object oriented programming (OOP) programs becomes more important as the programs grows in size and complexity. The Python has been the object oriented language since it is developed.Read More
Now we arrived at object-oriented programming. This has (had) its hype where every language was designed around objects and Python developer Guido van Rossum thought "Why not?" and added classes to support object-oriented development. Some python evangelists think this was a bad decision, some think it was a good approach...Read More
We have seen this example previously. There I included a lot of loops to handle user input and the main logic... Now it is time to refactor the application to use functions. This should make the code readable and we could re-use parts later.Read More
Now we have learned the basics of Python programming: variables, collections and loops. If you have followed the examples and the tutorial you might feel that sometimes we use too much code and it can be leveraged a bit. But maybe you do not know how to do it. Most of the time the solution is to introduce functions. We have encountered functions of other modules which we used just like isupper() of strings or choice() of the random module.
If you have learned mathematics then you know about functions already. Mathematicians can do very nasty things with them but programmers too. The aim of a function is to produce a result which is determined only by the parameters passed to the function.Read More