Seaborn is a Python visualization library built on top of matplotlib. It provides the interface for drawing statistical graphics. It simplifies the process of creating complex visualizations such as histograms, bar plots, etc. In this article, we are going to learn how to plot a graph using Seaborn in Python. To use Seaborn, we need to install it by using the command below. pip install seaborn Now, import the required libraries: import seaborn as sns import matplotlib.pyplot as plt Using seaborn.lineplot() Method The seaborn.lineplot() method is used to draw a line plot with the possibility of ... Read More
Printing sublists in PythonThe sublist is a portion of the list that contains one or more elements from the original list. These sublists can be contiguous(elements appear in the same order) or non-contiguous(where elements are taken from different positions). Example: Printing all Contiguous SublistsLet's look at the following example, where we are going to print all the contiguous sublists of the given list using nested loops. def demo(a): for i in range(len(a)): for j in range(i, len(a)): print(a[i:j+1]) x ... Read More
The string manipulation is the common task in the python programming, especially when working with the text based data. In this article we will explore how to reverse each word in a sentence. Generally, we reverse the entire sentence, where the both characters and the word positions are flipped, but in this task we are reversing only characters within each word while maintaining the original sequence of the words. For example if the input is "Welcome", the expected output would be "emocleW". Using Python split() Method The Python split() method is used to split all the words in ... Read More
Reserved keywords are the special words that are predefined by the language. These keywords are used to define the structure and syntax of the Python programs. They cannot be used as variable names, function names, or identifiers. Python has a fixed set of keywords that are recognized by the interpreter, and these keywords cannot be redefined. The Python keywords are case sensitive. To view all the keywords in the current Python version, we can use the built-in keyword module along with the 'keyword.kwlist' attribute to return the list of all the reserved keywords in Python as a list ... Read More
In Java, as we know, Collections are one of the most important concepts that make Java a powerful language in itself. It's the support of collections in Java that makes it support any type of data in a convenient and efficient way, along with possible CRUD operations over them. But on the same phase, when collections get exposed to a multi-threading its performance gets somewhat degraded because somewhere collections lack the support for a multi-threading environment. To overcome this limitation, Java introduces Concurrent Collections, which not only overcome the multi-threading environment limitation but also enhance Java to perform with multiple ... Read More
In this article, we will learn about the POSIX character classes p{Digit} Java regex. First, will know about \p{Digit} and the use of \p{Digit} along with examples. What is \p{Digit}? In Java regex, the \p{Digit} is a POSIX (Portable Operating System Interface) character class in Java regular expressions that matches any decimal digit character. This class matches decimal digits from 0 to 9. The \p{Digit} is also equivalent to other expressions in Java: "\d": Follows the same POSIX standards. "[0-9]": For ASCII digits only. How to Use \p{Digit} in Java? We can use the ... Read More
In this article, we will learn to get the date and time in JShell in Java 9. First, we will learn about the date and time class in Java with an example, and after that will learn about date and time in JShell with multiple examples. JShell JShell is an interactive command-line tool that allows us to learn, investigate, and explore the Java language and its API. We can type any valid Java code into the console and get immediate results without the need to write a verbose class with the main() method. C:\Users\User>jshell | Welcome to JShell -- Version ... Read More
The void pointer is a pointer which is not associate with any data types. It points to some data location in storage means points to the address of variables. It is also called general purpose pointer. Is It Safe to Delete a Void Pointer in C/C++? It is not safe to delete a void pointer in C/C++ because delete needs to call the destructor of whatever object it's destroying, and it is impossible to do that if it doesn't know the type. C Example of Void Pointer In this example, a void pointer (void *p) can store the address of ... Read More
In C++, a map is defined by an element storage container in the form of key-value pairs where each key is unique and mapped with a respective value. While range-based for loop is a very simple approach to iterate over elements in the container. In this article, we will learn the usage of range-based for loop over std::map in C++. Example Scenario Input: myMap: { {1, "Ravi"}, {2, "Tom"} } Output: 1: Ravi 2: Tom What is std::map? The std::map is an associative container that stores key-value pairs in sorted order. The maps are used for fast lookup, insertion, and deletion based on keys.Following is the basic ... Read More
In this article, we are going to learn how to use the map() function along with dictionaries to add the ASCII values of characters in the string. The Python built-in ord() function returns the ASCII integer value of a character. Additionally, dictionaries (dict) in Python are used to store key-value pairs. We use them to associate strings with their total ASCII values, making it easy to store and retrieve the result. Before diving into the examples, let's have a quick look at the Python map() function and the Python ord() function. Python map() Function The Python map() function ... Read More