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 do I get an ISO 8601 date in string format in Python?

SaiKrishna Tavva
Updated on 16-Jun-2025 15:47:20

64K+ Views

The ISO 8601 standard defines an internationally recognised format for representing dates and times. ISO 8601 is a date and time format that helps remove different forms of the day, date, and time conventions worldwide. In this article, we will discuss several methods to get an ISO 8601 date in string format in Python. ISO 8601 Date Format In Python,  ISO 8601 date is represented as "YYYY-MM-DDTHH:MM:SS.mmmmmm" format. For example, August 25, 2023, is represented as 2023-08-25T14:35:45.123456. YYYY: Year (four digits) MM: Month (from 1-12) DD: Days (from ... Read More

How to convert a list into a tuple in Python?

Nikitasha Shrivastava
Updated on 16-Jun-2025 15:01:33

27K+ Views

List and Tuple in Python are classes of data structures. The list is dynamic, whereas the tuple has static characteristics. In this article, we will convert a list into a tuple by using a few methods. Each of these methods is discussed below. Converting List into Tuple using tuple() We can convert a list into a tuple using the tuple() function. This function accepts a list as a parameter, converts into a tuple and returns the result.Example 1 In the following program, we convert a list to a tuple using the tuple() function. # using tuple() built-in function list_names=['Meredith', 'Kristen', 'Wright', ... Read More

How do we use Python regular expression to match a date string?

Nikitasha Shrivastava
Updated on 16-Jun-2025 12:32:16

7K+ Views

Regular expressions, or regex, are useful in Python when you need to find patterns in text. If you want to perform verification for a string that contains a date, in this case regex is useful. In this article, we will learn simple ways to match date strings using Python regex in the coming sections. Dates can come in many formats, like - YYYY-MM-DD YYYY/MM/DD YYYY.MM.DD YYYYMMDD DD-MM-YYYY DD/MM/YYYY Regular expression helps us find these patterns easily, so we can validate or extract dates from the given text. There are several ways to match a date string ... Read More

What is Raw String Notation in Python regular expression?

Nikitasha Shrivastava
Updated on 16-Jun-2025 12:27:36

6K+ Views

This article will discuss what raw string notation is in Python regular expressions. Regex is a set of characters that specifies a search pattern and is mostly used in text processors and search engines to execute find and replace operations.In Python,  regular expressions are used to find patterns in text. But some characters (like and \t) may create problems. Raw string notation (r'') can be useful here! This allows Python to treat backslashes as normal characters, which makes regex patterns easy to create and interpret. Python uses "" to escape characters in raw strings. This can change your regex pattern, ... Read More

How to get file creation & modification date/times in Python?

Nikitasha Shrivastava
Updated on 16-Jun-2025 12:17:24

16K+ Views

There are various ways to get the file creation and modification datetime in Python. We will use different methods from the OS and pathlib module to get the file creation and modification datetime in Python. Using OS Module: File Creation Time On Windows Using OS Module: File Modification Time On Windows ... Read More

How to convert a Python date string to a date object?

Nikitasha Shrivastava
Updated on 16-Jun-2025 12:02:41

9K+ Views

In this article, we convert a date string to a date object. We will use the strptime() method to convert a date string to a date object, and we will also use the dateutil module for flexible date parsing. A date string is a date written in text form, like "09 May 2025" or "2025-05-09". To work with dates in Python, we will have to convert these strings into date objects. To achieve this, we can use Python's datetime and dateutil modules. Using the strptime() Function The strptime() method takes the date as input and converts it into a ... Read More

Calling a member function on a NULL object pointer in C++

Ravi Ranjan
Updated on 13-Jun-2025 18:53:46

1K+ Views

You can call a class member function using a NULL object pointer in C++. This is an undefined behavior and there is no guarantee about the execution of the program. The actual results depend on the compiler used. Class Member Function A class member function is a function that is defined either inside a class or outside a class using a scope resolution operator. Example Here is an example of class member functions in C++ where the print() function is an example of the Inside class function and the print2() function is ... Read More

Tokenizing a string in C++

Farhan Muhamed
Updated on 13-Jun-2025 18:51:05

7K+ Views

Tokenization refer to the process of breaking a string based on certain delimiters such as spaces, commas, semicolons, or any other character. Mostly white spaces are used as delimiters to tokenize strings. In this article, we will discuss all the ways tokenize a string in C++. For example, if we have a string like "Hello, World! Welcome to Tutorialspoint.", we can tokenize it like this: string str = "Hello, World! Welcome to Tutorialspoint."; tokens = {"Hello", "World", "Welcome", "to", "Tutorialspoint"}; Tokenizing a String in C++ In C++, we can tokenize a string using various methods. Here are ... Read More

C++ Program to Check Whether Topological Sorting can be Performed in a Graph

Farhan Muhamed
Updated on 13-Jun-2025 18:50:30

675 Views

In this article, we will learn what is topological sorting, how to use it to detect cycles in a directed graph, and how to implement it in C++. What is Topological Sort? Topological sorting is an operation used to detect cycle in a graph. In this operation we order the vertices in such a way that for every directed edge u -> v, vertex u comes before vertex v in the ordering. If we are able to perform a topological sort in a graph, it means that the graph is a directed acyclic graph (DAG). The image below show ... Read More

Advertisements