Found 26504 Articles for Server Side Programming

How does * operator work on list in Python?

Nikitasha Shrivastava
Updated on 16-May-2025 18:06:22

17K+ Views

In Python, a list is an ordered sequence that can hold several object types such as integer, character, or float. In other programming languages, a list is equivalent to an array. In this article, we will show you how the * operator works on a list in python. So we will show you different examples to understand how * works on a python list in the below section − Repetition Operator(*) A repetition operator is supported by sequence datatypes (both mutable and immutable). The repetition operator * creates several copies of that object and joins them together. When used with ... Read More

How to sort the objects in a list in Python?

Vikram Chiluka
Updated on 03-Nov-2023 02:44:41

2K+ Views

In Python, a list is an ordered sequence that can hold several object types such as integer, character, or float. In other programming languages, a list is equivalent to an array. Square brackets are used to denote it, and a comma (, ) is used to divide two items in the list. In this article, we will show you how to sort the objects and elements in a list using python. Below are the different methods to accomplish this task − Using sort() method Using sorted() method Assume we have taken a list containing some elements. We will ... Read More

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

909 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

777 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

163 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

Advertisements