
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 10476 Articles for Python

14K+ Views
By default, Python regular expressions (regex) look for case-sensitive matches. That is, the terms "apple" and "Apple" are not synonyms. But sometimes we want to search without consideration for uppercase or lowercase. This is referred to as a case-insensitive match. This chapter teaches you how to create case-insensitive regexes in Python without using re.compile(). What is a Regular Expression? A regular expression (regex) is a pattern that enables you to find strings like - Emails Phone Numbers Names Or any pattern. To interact with regular expressions, we use the Python built-in module re. Import the re Module Before ... Read More

13K+ Views
To extract decimal numbers from a string in Python, regular expressions are used. A regular expression is a group of characters that allows you to use a search pattern to find a string or a set of strings. RegEx is another name for regular expressions. The re module in Python is used to work with regular expressions. In this article, we will learn how to extract decimal numbers from a string in Python using regular expressions. To retrieve non-digit characters from a string, we use the following regular expression - \d+\.\d+ Where, \d returns a match where the string contains ... Read More

57K+ Views
In Python, a list is an ordered sequence that can hold several object types, such as integers, characters, or floats. In this article, we will show you how to check if the given input list is empty or NOT using Python. Below are the 5 methods to accomplish this task - Using not operator Using len() function By Comparing with an Empty List Using __len__() Method Using NumPy Module Assume we have taken an empty list. We will check if the input list is empty or not and return some random message for acknowledgment using different methods as ... Read More

434 Views
A nested list is a list that has lists as elements. For example: [[1, 2, 3], [4, 5, 6], [7, 8, 9]] is a nested list as it has 3 lists ([1, 2, 3], [4, 5, 6], and [7, 8, 9]) as its elements. To flatten a list of lists (nested list), i.e., to convert a 2D list into a 1D list, there are different ways such as Nested for loop, List Comprehension, Built-in Functions, or by importing libraries in Python. In this article, we will discuss the above methods to flatten a list in Python. Using for loops For ... Read More

688 Views
Python includes a built-in package i.e random module for generating random numbers. In this article, we will show you how to generate random numbers in python using different methods - Using random.seed() Method Using random.randrange() Method Using random.randint() Method ... Read More

7K+ Views
Python is not a "statically typed" programming language. We do not need to define variables or their types before utilizing them. Once we initially assign a value to a variable, it is said to be created. Each variable is assigned with a memory location. The assignment operator (=) assigns the value provided to right to the variable name which is at its left. The syntax of the assignment operator is shown below - var_name = value Example of Assignment Operator The following is an example that shows the usage of the assignment operator - Name = 'Tutorialspoint' In ... Read More

7K+ Views
In Python, lists are a useful way to store multiple elements in a single variable. To assign values to each entry in a list, loops are often needed. This strategy simplifies the process and improves the clarity of your code. This chapter will look at how to assign values to variables in a list using different loop types, using basic examples. Using Simple Loop Iterations In this method, we use the for loop to append elements to the lists. When we do not enter any element into the list and stop appending, then we just press the Enter key. To ... Read More

44K+ Views
The Python tuple elements are enclosed inside the parentheses, while dictionary elements are present in the form of a key-value pair and are enclosed between curly brackets. In this article, we will show you how to convert a Python tuple into a dictionary. The following are the methods to convert a tuple into a dictionary - Using dict() Function Using Dictionary Comprehension and enumerate() Function ... Read More

1K+ Views
Python provides a variety of data structure collections such as lists, tuples, sets, and dictionaries. However, these tuples are very similar to lists. Because lists are a commonly used data structure, developers frequently mistake how tuples differ from lists. Python tuples, like lists, are a collection of items of any data type, but tuples are immutable, which means that once assigned, we cannot change the elements of the tuple or the tuple itself, whereas list elements are mutable In this article, we will explain to you what is a tuple in python and the various operations on it. Creating a ... Read More

680 Views
In Python, an index is an element's location within an ordered list. Where n is the length of the list, and the first entry has a zero index, and the last element has an n-1 index. In this tutorial, we will look at how to find out the index of an element in a list in Python. There are different methods to retrieve the index of an element. Using index() method Three arguments can be passed to the list index() method in Python - element: element that has to be found. start ... Read More