Pradeep Elance has Published 417 Articles

Associating a single value with all list items in Python

Pradeep Elance

Pradeep Elance

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

344 Views

We may have a need to associate a given value with each and every element of a list. For example − there are the name of the days and we want to attach the word day as a suffix in them. Such scenarios can be handled in the following ways.With ... Read More

Standard errno system symbols in Python

Pradeep Elance

Pradeep Elance

Updated on 09-Jul-2020 13:54:07

505 Views

Every programming language has a error handling mechanism in which some errors are already coded into the compiler. In Python we have love which are associated with some standard pre-determined error codes. In this article we will see how to to get the error numbers as well as error codes ... Read More

Python module to Generate secure random numbers

Pradeep Elance

Pradeep Elance

Updated on 09-Jul-2020 13:52:01

303 Views

In this article we will see how we can generate secure Random numbers which can be effectively used as passwords. Along with the Random numbers we can also add letters and other characters to make it better.with secretsThe secrets module has a function called choice which can be used to ... Read More

Python Get the numeric prefix of given string

Pradeep Elance

Pradeep Elance

Updated on 09-Jul-2020 13:49:25

409 Views

Suppose we have a string which contains numbers are the beginning. In this article we will see how to get only the numeric part of the string which is fixed at the beginning.With isdigitThe is digit function decides if the part of the string is it digit or not. So ... Read More

Python Get a list as input from user

Pradeep Elance

Pradeep Elance

Updated on 09-Jul-2020 13:46:54

10K+ Views

In this article we will see you how to ask the user to enter elements of a list and finally create the list with those entered values.With format and inputThe format function can be used to fill in the values in the place holders and the input function will capture ... Read More

Python Generate successive element difference list

Pradeep Elance

Pradeep Elance

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

457 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

630 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

471 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

Advertisements