Found 33676 Articles for Programming

How to append objects in a list in Python?

Nikitasha Shrivastava
Updated on 16-May-2025 18:01:11

20K+ Views

List is one of the most commonly used data structures provided by python. List is a data structure in Python that is mutable and has an ordered sequence of elements. In this article, we will discuss how to add objects to a list and the different ways to add objects, such as append(), insert(), and extend() methods, in Python. Using append() method In this method, we use append() to add objects to a list. The append() method adds a new element to the end of a list that already exists. Example 1 In this example, we used the append() method ... Read More

How to find the element from a Python list with a minimum value?

Nikitasha Shrivastava
Updated on 16-Jun-2025 16:11:33

3K+ Views

A list is one of the most commonly used data structures in Python. It is mutable and has an ordered sequence of elements. In this article, we will find the element from a given list with the minimum value. We will see different examples and different ways to do this. But first, let us see how do define a list in Python. Defining a List Following is a list of integer values - lis= [12, 22, 32, 54, 15] print(lis) When you run the program, it will show this output - [12, 22, 32, 54, 15] In this article, ... Read More

How to find the element from a Python list with a maximum value?

Nikitasha Shrivastava
Updated on 16-May-2025 17:57:53

10K+ Views

List is one of the most commonly used data structures provided by Python. List is a data structure in Python that is mutable and has an ordered sequence of elements. Here is a simple example of a list of integer values - lis= [1, 2, 3, 4, 5] print(lis) If you execute the above program, it produces the following output [1, 2, 3, 4, 5] In this article, we will look at different ways to find the maximum of the list in Python. For the above list the maximum or largest element of the list is 5. Using ... Read More

What are character classes or character sets used in Python regular expression?

Nikitasha Shrivastava
Updated on 07-May-2025 17:54:57

2K+ Views

In this chapter, we will understand character classes, how they work. and provide simple examples and programs to explain their usage. One of the main components of regular expressions is character classes or character sets. Character classes help you to define a set of characters that will match in a string. They can be used to define a range of characters or specific characters to consider during a search. Character Classes or Character Sets A "character class, " also known as a "character set, " which helps you inform the regex engine to match only one of numerous characters. Simply ... Read More

How can import python module in IDE environment available in tutorialspoint?

Malhar Lathkar
Updated on 23-Apr-2025 17:29:16

906 Views

The Tutorialspoint coding environment normally helps you to run Python code directly in your browser, but the capacity to import external modules can be limited. Importing Python Module So you can use Python's built-in libraries and modules. To load a module into the Python IDE environment on tutorialspoint, follow the steps below - Step 1: First of all, you need to open the Tutorialspoint Python IDE. So, go to the Tutorialspoint Python IDE. ... Read More

How to pass JavaScript variables to PHP?

Johar Ali
Updated on 30-Jul-2019 22:30:21

21K+ Views

You can easily get the JavaScript variable value on the same page in PHP. Try the following codeL. var res = "success";

How to write Python regular expression to get zero or more occurrences within the pattern?

Nikitasha Shrivastava
Updated on 23-Apr-2025 10:36:49

775 Views

In this article we will be using Regular Expression to get zero or more occurrences within the pattern. Regular expressions (regex) are important features to identify patterns in text. In Python, the re module provides support for working with regex. The concept of zero or more occurrences is a key regex feature. This means that a pattern can appear somewhere between zero and an infinite number of times. Zero or More Occurrences? In regex, the * symbol denotes zero or more instances of the preceding element. For example, the pattern a* will match - ... Read More

What Python regular expression can be used in place of string.replace?

Nikitasha Shrivastava
Updated on 23-Apr-2025 11:02:07

162 Views

In this article, we are going to discuss how to use regular expressions in place of a string.replace() method. As you may know, Python's built-in string.replace() method is used to replace given substrings in a string. But when we need more complex replacement features so Python's re (regular expressions) module is very helpful. Regular expressions allow us to search for patterns and replace them with precise values, which makes string manipulation simpler. Why Use Regular Expressions? While string.replace() works well for simple tasks, it has its limitations, like it can only replace exact substrings and has limited ability to use pattern ... Read More

How does B regular expression work in Python?

Nikitasha Shrivastava
Updated on 23-Apr-2025 12:38:24

714 Views

In this article, we will see the concept of B-regular expressions in Python. Regular expressions (regex) are a useful tool for matching patterns in strings. In Python, the re module helps you to work with regex patterns. What is a B Regular Expression? A 'B' regular expression is a type of regex that searches and matches particular patterns within a string. For example, it can be used to find out whether a string starts or ends with a given letter or whether it matches the pattern's set criteria. Use the re Module For using regular expressions in Python, you need ... Read More

How you can get a true/false from a Python regular expressions?

SaiKrishna Tavva
Updated on 23-Apr-2025 11:40:41

5K+ Views

The re module provides tools while working with Python's regular expression (regex), which allows us to search for any specific pattern within the strings. Using the 're' module provides two functions named match() and search(),  which accept a pattern (regular expression) and return True or False. The match() function returns 'None' if no pattern is detected, or it returns the match in the form of an object (in case of a match). In addition to these, we can also use the fullmatch() function to get a boolean result from a regular expression. ... Read More

Advertisements