Home » Python

Python

Generate random numbers in Python

There are two types of random number generators: pseudo-random number generator and true random number generator.Pseudorandom numbers depend on computer algorithms. The computer uses algorithms to generate random numbers. These random numbers are not truly random because they are predictable like the generated numbers using NumPy random seed. Whereas, truly random numbers are generated by measuring truly physical random parameters ...

Read More »

Python Priority Queue (Step By Step Guide)

A queue is a data structure that retrieves data items in an order called FIFO (first in first out). In FIFO, the first inserted element will be popped out first from the queue. The Priority Queue is an advanced version of the Queue data structure. The element with the highest priority is placed on the very top of the Priority ...

Read More »

Slicing In Python (Comprehensive Tutotial)

Programming in Python involves frequently working with sequential or ‘indexed’ data. Indexed data are the ones stored in such structures that allow their access using indices.Such data can be of varying lengths, from a few elements to hundreds of thousands of elements.However, most of the time, we are interested in working only on a small subset of the data. While ...

Read More »

A Foolproof Guide to Infinity In Python

Numbers are an integral part of programming. Hence, programming languages support various datatypes to represent different kinds of numbers and provide various methods to work with them.Each of these datatypes comes with certain limitations on the range of numbers they can represent; while some can represent a small range of numbers, others support a very large range of numbers. Depending ...

Read More »

Python map() Function (Loop without a loop)

Have you been using for loops to perform repetitive tasks on a list of items in Python?Did you wish there existed a more efficient way to apply functions to every item in a Python list?If you answered yes, you are yet to discover an important and powerful tool in Python – the map() function. In this tutorial, we will uncover the capabilities of a ...

Read More »

11 Amazing NumPy Shuffle Examples

Python’s NumPy package offers various methods that are used to perform operations involving randomness, such as the methods to randomly select one or more numbers from a given list of numbers, or to generate a random number in a given range, or to randomly generate a sample from a given distribution. All these methods are offered under the random module of ...

Read More »

The Unconventional Guide to Colors In Python

If you have been programming in Python, chances are high that you have encountered at least one library that offers functionalities dealing with representation and customization of colors.From image processing to data visualization to web application development, you will find the use of colors everywhere.In fact, most of the modern deep neural networks used for the state of the art ...

Read More »

NumPy Meshgrid From Zero To Hero

What is a meshgrid? The term meshgrid is made up of two words – ‘mesh’ and ‘grid’, both of which in generalrefer to ‘a network’ or ‘an interlaced structure’ or an ‘arrangement’ of equally spaced valuesThe Cartesian coordinate system is a classic example of this. As shown in the image, each position is referred to by an ordered pair of ...

Read More »

3D plotting in Python using matplotlib

Data visualization is one such area where a large number of libraries have been developed in Python. Among these, Matplotlib is the most popular choice for data visualization. While initially developed for plotting 2-D charts like histograms, bar charts, scatter plots, line plots, etc., Matplotlib has extended its capabilities to offer 3D plotting modules as well. In this tutorial, we ...

Read More »