Found 34494 Articles for Programming

Python - Filter Tuples with All Even Elements

Tapas Kumar Ghosh
Updated on 17-Aug-2023 18:14:59

171 Views

The problem statement allows us to determine the position of the desired string in the list, which can be useful for various purposes, such as accessing or manipulating elements at that specific index. In Python, we have some built-in functions like reduce(), str(), filter(), lambda, and, all() that will be used to Find Index Containing String in List. Syntax The following syntax is used in the examples- reduce() This function is defined under the functools module str() This is a built-in method in Python that can convert the specified value into a string. filter() The ... Read More

Get Interior & Exterior Angle of Regular Polygon When Numbers of Sides of Polygon is Given in Java

Mr. Satyabrata
Updated on 17-Aug-2023 17:17:31

77 Views

A polygon is a 2-dimensional closed shape that has at least 3 sides. Depending on the number of sides, relationships of the sides and angles, and other characteristics, polygons can be classified under different names like triangles, squares, and quadrilaterals. An interior angle of a polygon is an angle formed inside the two adjacent sides of a polygon. Exterior angle is defined as the angle formed between a side of triangle and an adjacent side extending outward. In this article, we will find interior and exterior angle of regular polygon when numbers of sides of polygon is ... Read More

Program to check if a String in Java contains only whitespaces

Tapas Kumar Ghosh
Updated on 17-Aug-2023 18:10:38

2K+ Views

The whitespaces of JAVA represent either an empty string or an escape sequence character. In Java, we have some built-in functions such as isEmpty(), lenThe whitespaces of JAVA represent either an empty string or an escape sequence character. In Java, we have some built-in functions such as isEmpty(), length(), isWhitespace(), and, charAt() that will be used to check if a String in Java contains only whitespaces. The whitespaces in the program are only used for formatting purposes such as (new line), \t(horizontal tab), \v(vertical tab), etc. Syntax The following syntax is used in the examples- isEmpty() The built-in function ... Read More

Check if a Word is Present in a Sentence

Tapas Kumar Ghosh
Updated on 17-Aug-2023 18:05:20

616 Views

A sentence is a group of words that are present in a string. In this problem statement, we need to set a specific word and check whether the word is present in a given string or not. In C++, we have some pre-defined functions such as find(), npos(), and istringstream() will be used to Check if a word is present in a sentence. Using Standard library Function The program uses a standard library function that allows the programmer to use pre-existing functions of the C compiler such as find() and npos() to perform certain tasks. Syntax The following syntax is ... Read More

Check if a number with even number of digits is palindrome or not

Tapas Kumar Ghosh
Updated on 17-Aug-2023 18:02:54

197 Views

The palindrome refers to same number when the digits are reversed. In this program, we need to set the condition and operation based on an even number of digits to identify whether the given input satisfied for palindrome or not. In C++, we have STL(Standard template library) functions such as to_string(), length(), rbegin(), rend(), and, push_back() will be used to Check if a number with an even number of digits is palindrome or not. For example- 2662, 42124, 44, 888, etc are satisfied for even digit palindrome numbers. Using for loop and if-else statement The program uses for loop to ... Read More

How to Know the Separator for a Particular File System in Java

Mr. Satyabrata
Updated on 17-Aug-2023 17:13:07

417 Views

In Java, the file separator is a character that separates the components of a file path. The file separator varies depending on the operating system on which the Java program is running. On Windows systems, the file separator is backslash (\). On Unix-based systems (such as Linux and macOS), the file separator is forward slash (/). Let's start! For instance Suppose that we running the code on windows system After performing the operation to get the separator, the result will be: Separator for this file system is: \ Algorithm Step-1: Import the necessary libraries. ... Read More

Python - K List Dictionary Mesh

Tapas Kumar Ghosh
Updated on 17-Aug-2023 17:58:41

70 Views

The term dictionary Mesh is defined by storing the value pair of every key set to dictionary. To include the K list in the dictionary means to insert the list as value pair. In Python, we have some built-in functions such as defaultdict() and lambda will be used to solve the K list dictionary Mesh. Let’s take an example of this. Given input list, list1 = [10, 20, 30] list2 = [40, 50] The final output becomes: {10: {40: [], 50: []}, 20: {40: [], 50: []}, 30: {40: [], 50: []}} Syntax The following syntax is used ... Read More

Check If a Particular File System is Open or Not in Java

Mr. Satyabrata
Updated on 18-Aug-2023 09:15:39

460 Views

In Java, a file system is a hierarchical structure used to organize and store files and directories on a storage device. It provides a standard way to access and manipulate files and directories, regardless of the underlying storage device, such as a hard disk, USB drive, or cloud storage. Java provides the java.nio.file package, which contains classes and interfaces for working with file systems. The FileSystem interface represents a file system, and its FileSystems class provides factory methods for creating instances of FileSystem. You can check if a particular file system is open or not by using the FileSystem ... Read More

How to Know the File Store Type in Java?

Mr. Satyabrata
Updated on 17-Aug-2023 17:09:04

104 Views

In Java, the java.nio.file.FileStore class represents a storage pool, device, partition, volume, or other implementation-specific means of file storage. The FileStore class provides methods for querying information about the storage device, such as its total and available space, its file system type, and whether it supports certain features like file attributes or symbolic links. The type() method of the FileStore class returns a string representing the file store type. The file store type is a string that identifies the type of file system used by the file store. Examples of file system types include "NTFS" for the Windows NT ... Read More

How to Know Where the Actual File is Getting Stored in Java?

Mr. Satyabrata
Updated on 17-Aug-2023 17:03:44

63 Views

In Java, you can use the File class to represent and manipulate file and directory paths. You can also use the File class to create, delete, and manipulate files and directories. To know where the actual file is getting stored in Java, you can use the getAbsolutePath() method of the File class. This method returns a string representation of the absolute path of the file, which includes the full path from the root directory to the file. Let's deep dive into the article to see where the actual file is getting saved in Java. For instance ... Read More

Advertisements