Rolling the Dice

We all have played dice games when we were kids. The unique thing about a dice is that it gives a random number from 1 to 6 without favoring any number.  How can you make a machine that can generate random numbers? Can a program be written to iterate from 1 to 6 and randomly... Continue Reading →

Mathematics with Python

We learnt about modules in the previous blog. In this blog ,we use a built in module called math to do mathematical operations. The entire list of function in math module is given in math module functions. To use the math module , you need to use import keyword. The statement is written as: import math ... Continue Reading →


A module is a file containing python definitions( functions and variables) and statements.The file name is the module name with the suffix  .py appended. We need modules to reuse many functions,variables and statements. To import a module in a program, we use the import keyword along with the name of the module. Ex: import operation. The... Continue Reading →

Local and Global Variables

Variable name not defined is a common error faced by programmers. It is very important to know about local and global variable declarations. In this blog, we learn the difference between local and global variables. First thing we need to know here is the definition of scope of a variable. The scope of a variable... Continue Reading →

Python Dictionaries

We have seen how lists work in Python. A dictionary is like a list. But a list just contains values but a dictionary associates with each key a value. Just like how in a dictionary , each word maps to a particular meaning, in Python , a dictionary has keys and value associated with each... Continue Reading →


We can use Python to create patterns. Let us see what the following code produces. Let us go through the code step by step. First we define the function called patterncreate which accepts a number n as input. n is the length of the pattern. Here n is the formal parameter of the function. We... Continue Reading →

Recursive functions

We  have seen the role of user defined functions earlier. The main reason why we use a function is because of its re-usability. We can call the same function again and again rather than writing the same piece of code multiple times. Today we will learn about recursive functions. A recursive function is a function... Continue Reading →

Let us make a calculator !

Hope you have followed all my previous blogs. In this blog, we use all the concepts that we have learnt in the previous blogs to make a simple python calculator. This requires the concepts of user defined functions,numbers,strings and some basic input-output commands. Hope you are excited to make your first Python calculator !! So... Continue Reading →

Powered by

Up ↑