random() function of random module generates a random float number between 0.0 and 1.0. The actual range of random function is semi-open range [0.0, 1.0). import random random.random()
In this article, we will go through different methods to find the length of string in Python. Method 1: len() Output: Method 2: for loop Output: Method 3: while loop and slicing Output: Note that, len() is the most efficient …
In comparing lists, we are checking the data items of a list against equality with data items of another list. In this article, we will discuss different ways to compare two lists. Method 1: Using list comprehension Output: Method 2: …
Python packages make the language more unique and efficient. Apart from the inbuilt packages, there are too many external packages written and attached to Python. If you want to use these packages you simply have to install them. NumPy is …
XLSX file popularly known as Excel file is a spreadsheet which makes us easy to store data in a tabular form. Now the question is that how can we read data from the excel file while writing a python program? …
Speech Recognition is a process which converts speech into text and that is understood by the machine. In python there is a library by which we can make the machine to recognize human speech. Speech recognition saves our time by …
The word PYTHON- isn’t it scary? Does it bring the image of big reptile that we prefer to see either in jungles or zoo? Well, it’s time to change the image. Now on, you’ll remember word Python for its playfulness …
Python gives us freedom to take the input from the user. The input we take from the user is read as string by default. After giving input we have to press “Enter”. Then only the input() function reads the value …
Converting float to int is type conversion. We can simply do the same using int(). But keep in mind that this type of type conversions can cause loss of data. For example, if we try to convert the float number …
The sort() function can be used to sort the list. You can sort it in the ascending order, descending order or even in user defined order. Syntax: list_name.sort(reverse=True/False, key=fucntion_name) reverse – optional parameter. reverse=True will sort in descending order. Default …