Pradeep Elance has Published 445 Articles

Python Generate successive element difference list

Pradeep Elance

Pradeep Elance

Updated on 09-Jul-2020 13:44:31

345 Views

In this as its elements article we will see how to find the difference between the two successive elements for each pair of elements in a given list. The list has only numbers as its elements.With IndexUsing the index of the elements along with the for loop, we can find ... Read More

Python Generate random string of given length

Pradeep Elance

Pradeep Elance

Updated on 09-Jul-2020 13:42:12

474 Views

In this article we will see how how to generate a random string with a given length. This will be useful in creating random passwords or other programs where randomness is required.With random.choicesThe choices function in random module can produce strings which can then be joined to create a string ... Read More

Python Generate random numbers within a given range and store in a list

Pradeep Elance

Pradeep Elance

Updated on 09-Jul-2020 13:39:55

375 Views

In this article we will see how to generate Random numbers between a pair of numbers and finally store those values into list.We use a function called randint. First let's have a look at its syntax.Syntaxrandint(start, end) Both start and end should be integers. Start should be less than end.In ... Read More

Python fsum() function

Pradeep Elance

Pradeep Elance

Updated on 09-Jul-2020 13:37:18

200 Views

fsum() finds the sum between a given range or an iterable. It needs the import of the math library. Its widely used in mathematical calculations.SyntaxBelow is the syntax of the function.maths.fsum( iterable ) The iterable can be a range, array , list. Return Type : It returns a floating point ... Read More

Python frexp() Function

Pradeep Elance

Pradeep Elance

Updated on 09-Jul-2020 13:35:21

156 Views

This function is used to find the mantissa and exponent of a number. It is heavily used in mathematical calculations. In this article we will see the various ways it can be used in python programs.SyntaxBelow is the syntax and its description for using this function.math.frexp( x ) Parameters: Any ... Read More

Python Categorize the given list by string size

Pradeep Elance

Pradeep Elance

Updated on 09-Jul-2020 13:30:19

134 Views

Let's consider a list containing many strings of different lengths. In this article we will see how to club those elements into groups where the strings are of equal length in each group.With for loopWe design a for loop which will iterate through every element of the list and happened ... Read More

Correlation and Regression in Python

Pradeep Elance

Pradeep Elance

Updated on 09-Jul-2020 13:21:47

2K+ Views

Correlation refers to some statistical relationships involving dependence between two data sets. While linear regression is a linear approach to establish the relationship between a dependent variable and one or more independent variables. A single independent variable is called linear regression whereas multiple independent variables is called multiple regression.CorrelationSimple examples ... Read More

Converting an image to ASCII image in Python

Pradeep Elance

Pradeep Elance

Updated on 09-Jul-2020 13:10:56

474 Views

In this article we we want to convert a given images into a text bases image also called ASCII image.Below is the Python program which will take an input imagee and various functions to convert them into grayscale picture and then apply the ASCII characters to create different patterns insert ... Read More

Boolean list initialization in Python

Pradeep Elance

Pradeep Elance

Updated on 09-Jul-2020 13:04:18

1K+ Views

There are scenarios when we need to get a list containing only the Boolean values like true and false. In this article how to create list containing only Boolean values.With rangeWe use range function giving it which is the number of values we want. Using a for loop we assign ... Read More

Binary element list grouping in Python

Pradeep Elance

Pradeep Elance

Updated on 09-Jul-2020 12:46:49

169 Views

Suppose we have a list of lists in which each sublist has two elements. One element of each sublist is common across many other subjects of the list. We need to create a final list which will show sublists grouped by common elements.With set and mapIn the given list the ... Read More

Advertisements