Scroll to top

Python Tutorial

Posted by JBT
September 13, 2018

Python Generator

This article aims to provide a somewhat gentle introduction to python generator, and hopefully will…

Read More
Posted by JBT
November 4, 2016

Exception handling in Python 3.5

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.
Continue Reading

Read More
Posted by JBT
January 27, 2016

Python setup for Windows, Mac, Linux

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.
Continue Reading

Read More
Posted by JBT
January 2, 2016

Object Oriented Programming in Python

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.
Continue Reading

Read More
Posted by JBT
December 20, 2015

Dates and times with Python

Sometimes we have to work with dates and times. I use dates less than times because with times you can measure code execution time which is sometimes essential (for my website scraping book's performance measurement is the core part I guess).
Continue Reading

Read More
Posted by JBT
December 20, 2015

Object-Oriented Programming (OOP)

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...
Continue Reading

Read More
Posted by JBT
December 20, 2015

Python 3: Guess the number --The return

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.
Continue Reading

Read More
Posted by JBT
November 29, 2015

Python function

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.
Continue Reading

Read More
Posted by JBT
November 14, 2015

Python 3 : Guess the number

Now let's write a script which implements a basic "Guess the number" game. The rules of the game are:
Continue Reading

Read More
Posted by JBT
November 14, 2015

Python loops

Python Loop allows to loop through the program code and repeat blocks of code until a given condition is fulfilled or not fulfilled. The code which is repeated is called the loop's body. Python has two types of loops: the for loop and the while loop.
Continue Reading

Read More