Pradeep Elance has Published 498 Articles

Anagram checking in Python using collections.Counter()

Pradeep Elance

Pradeep Elance

Updated on 23-Aug-2019 09:04:13

168 Views

When two strings have same characters but arranged in different orders then they are called anagrams. For example, spot and post are anagrams as they have same letters forming different words. In this article we will see how can we check if two strings are anagrams of each other or ... Read More

Adding new column to existing DataFrame in Pandas

Pradeep Elance

Pradeep Elance

Updated on 23-Aug-2019 08:59:21

413 Views

Pandas Data Frame is a two-dimensional data structure, i.e., data is aligned in a tabular fashion in rows and columns. It can be created using python dict, list and series etc. In this article we will see how to add a new column to an existing data frame. So first ... Read More

howdoi in Python

Pradeep Elance

Pradeep Elance

Updated on 08-Aug-2019 06:58:23

155 Views

Create a Python ListExampleC:\Py3Project>howdoi create a python listOutputRunning the above code gives us the following result −>>> l = [None] * 10 >>> l [None, None, None, None, None, None, None, None, None, None]Printing Today’s DateExamplec:\python3>howdoi print today's date in pythonOutputRunning the above code gives us the following result −for ... Read More

How to print without newline in Python?

Pradeep Elance

Pradeep Elance

Updated on 08-Aug-2019 06:57:22

784 Views

In python the print statement adds a new line character by default. So when we have multiple print statements the output from each of them is printed in multiple lines as you can see in the example below. Our goal is to print them in a single line and use ... Read More

gcd() function Python

Pradeep Elance

Pradeep Elance

Updated on 08-Aug-2019 06:53:53

1K+ Views

Greatest common divisor or gcd is a mathematical expression to find the highest number which can divide both the numbers whose gcd has to be found with the resulting remainder as zero. It has many mathematical applications. Python has a inbuilt gcd function in the math module which can be ... Read More

floor() and ceil() function Python

Pradeep Elance

Pradeep Elance

Updated on 08-Aug-2019 06:53:20

2K+ Views

These two methods are part of python math module which helps in getting the nearest integer values of a fractional number.floor()It accepts a number with decimal as parameter and returns the integer which is smaller than the number itself.SyntaxSyntax: floor(x) Where x is a numeric valueExample of floor()In the below ... Read More

10 Interesting Python Cool Tricks

Pradeep Elance

Pradeep Elance

Updated on 08-Aug-2019 06:52:06

3K+ Views

With increase in popularity of python, more and more features are becoming available for python coding. Using this features makes writing the code in fewer lines and cleaner. In this article we will see 10 such python tricks which are very frequently used and most useful.Reversing a ListWe can simply ... Read More

How to download Google Images using Python

Pradeep Elance

Pradeep Elance

Updated on 08-Aug-2019 06:41:47

826 Views

Google offers many python packages which minimize the effort to write python code to get data from google services. One such package is google images download. It takes in the key words as parameters and locates the images with those keywords.ExampleIn the below example we limit the number of images ... Read More

How to clear screen in python?

Pradeep Elance

Pradeep Elance

Updated on 08-Aug-2019 06:38:47

4K+ Views

In Python sometimes we have link the output and we want to clear the screen in the cell prompt we can clear the screen by pressing Control + l . But there are situations when we need to clear the screen programmatically depending on the amount of output from the ... Read More

get() method for dictionaries in Python

Pradeep Elance

Pradeep Elance

Updated on 08-Aug-2019 06:36:37

183 Views

The get() method is part of standard python library to access the elements in a dictionary. Some times we may need to search for a key which is not present in the dictionary. In such case the accessing method by index is going to throw an error and halt the ... Read More

Advertisements