• Posted by allwinraju
  • September 11, 2020
  • 0 Comments

Run two loops simultaneously in python

In this article we shall see how to runs two loop simultaneously using python. This can be achieved by the zip() method. Using the zip() method In order to use the zip() function, first, we must know what this function does. According to the documentation, We will be using two range function to generate numbers […]

Read More
  • Posted by allwinraju
  • September 8, 2020
  • 0 Comments

Dynamic variables using python

In this article we shall see how to create dynamic variables in python. This will be helpful in scenarios where the user’s input has to be stored in a variable and access in later part of the program. Dynamic variables can be created using the following two ways. exec() dictionary Let us look at the […]

Read More
  • Posted by allwinraju
  • September 6, 2020
  • 0 Comments

Reverse words in a string using python

In this article, we shall see how to reverse words in a string using python. The mistake most often we make is we would reverse the entire string and not the words. Consider the following string. “Welcome to python coders blog” When somebody asks us to reverse the words what we have to is, and […]

Read More

List initialization in python

In this article we shall see how to initialise an empty list or a list of size n initialised with a value. The list initialisation can be done in the following ways. Using the list() We can directly initialise a list using the list() keyword. This will create an empty list for us. Using [] […]

Read More

Get metadata of a python package

In this article, we shall see how to find the metadata from a python package installed via pip from the pypi.org. Python has a built-in library called importlib_metadata which can be used to obtain these data. What metadata can be obtained? This library has a class called metadata which can be used to get almost […]

Read More

You should use these three methods from the random module

We all know python has a built-in module called random which can be used to generate random numbers and other random operations. We might have used some of the methods from the random module such as randint() – This method will take two numbers and return an integer value between those limits. choice() – This […]

Read More

String rotation using python

In this article we shall see how to perform string rotation using python. With the help of the slicing operation this can be achieved in a single line in python. What is string rotation? String rotation is the concept of shifting the characters in a string either right side or left side to the current […]

Read More

Flatten a list of dictionaries

In this article we shall see how to flatten a list of dictionaries. This can be done by the following two ways. Traditional approach Dictionary comprehension If you are a beginner the traditional approach will suit you. Dictionary comprehension method is suitable for intermediate programmers. Note: Dictionary comprehension is not difficult but flattening a list […]

Read More

Copy() method in python

In this article, we shall see the copy() method in python. Python has a built-in method called copy(). This method just copies the values alone instead of copying the address just like the assignment operator. It will be much easier to look at this with an example. In order to understand what this method does, […]

Read More