In this article, we will learn to convert a binary number into a decimal number. Given a binary number, we need to convert the binary number to its equivalent decimal form. Using loop Output: Using int() int() will convert the …
In this article, we will see how to convert an array to list in Python For this, we are using the built-in function in array module. The tolist() will convert the array to list without loosing any items. Output:
A String can be converted into list using the split() method. Syntax: string.split(delimiter) The split method is used to split the strings and store them in the list. It returns a list of the words in the string, with the …
Python supports string concatenation using + operator. However, in Python, if you try to concatenate string and int using + operator, you will get a runtime error. Lets see what happens when we try to concatenate string and int with …
In Python, multiple conditions can be checked using ‘and’ or ‘or’ or BOTH in a single if statement. Syntax: and = this work when both conditions provided with should be true. If the first condition falls false, the compiler doesn’t …
In this article, we will see how to check if an element is in a list in Python. Method 1: Naive method Here using the for loop we are iterating through all the elements to check the existence of the …
In this article, we will learn to check if a number is a perfect square in python Given below is the Python code to check if a number is a perfect square or not. The logic behind the code is …
We can automate almost everything with Python. This includes sending emails and filling out PDFs and CSVs to interacting with external APIs and sending HTTP requests. For simple automation, Python’s built-in libraries should be enough. In this article, let’s see …
Dictionary is one of the important data types available in Python. The data in a dictionary is stored as a key/value pair. It is separated by a colon(:), and the key/value pair is separated by comma(,). In this article, we …
In this article we will see how to add two lists in Python. If you are looking for “how to merge two list in python”, this article will help you for the same. Method 1: Using + operator Output: Method …