Python Sequence Types

SaiKrishna Tavva
Updated on 18-Dec-2024 19:22:23

10K+ Views

In Python programming, some basic sequence type classes are, Lists , Strings , Tuples, Range, etc, these data structures hold an ordered collection of items. They allow us to access their elements through indexing and iteration, there are additional sequence-type objects such as Byte sequences. Sequence Types In Python Sequence types in Python are categorized into two types they are mutable and immutable sequences. Mutable Sequence Types These Sequences can be changed after their creation, and also we can modify elements, adding new elements and removing existing ones. Lists: A list is a mutable, ordered ... Read More

What is Conditional Compilation in C Language

Sindhura Repala
Updated on 18-Dec-2024 17:18:13

14K+ Views

In C programming language, several directives control the selective compilation of different parts of the program code. Conditional Compilation is a set of preprocessing directives that allows us to exclude and include parts of a program based on specified conditions. Each directive in the compilation is processed across different platforms, including debug and release versions. They are as follows − #if #else #elif #endif The "#if" Directory The #if is a directive preprocessor that evaluates the expression or condition. If the condition ... Read More

JavaFX Area Chart Example

Maruthi Krishna
Updated on 18-Dec-2024 16:16:13

394 Views

The area chart accepts a series of data points (x, y) as input values, connects them using a line, and maps the area between the obtained line and the axis. In JavaFX, you can create an area chart by instantiating the javafx.scene.chart.AreaChart class. While instantiating this class you must pass the two objects of the Axis class representing the x and y axis (as parameters of the constructor). Since the Axis class is abstract you need to pass objects of its concrete subclasses, NumberAxis (for numerical values) or, CategoryAxis (String values). Area Chart with Multiple Series Follow the steps given ... Read More

SQL Query to Find Names Starting with a Specific Letter

Mohammed Shahnawaz Alam
Updated on 18-Dec-2024 15:50:28

7K+ Views

When we work with databases, we often need to search for the name of a Person whose name starts with a specific Letter. We can also find the names of persons whose name starts with a specific letter using SQL. This is possible by using the 'LIKE' operator in SQL, it allows us to do pattern matching on a text. Prerequisites: The following are the prerequisites to understand this tutorial - Basic SQL syntax understanding. A database management tool like MySQL, Oracle SQL or SQLite. What is 'LIKE' Operator? The ... Read More

Use X-Content-Type-Options to Prevent MIME Sniffing

Ashish Jha
Updated on 18-Dec-2024 12:26:27

1K+ Views

Data security maintenance plays a critical role in online applications. MIME Sniffing is one such vulnerability, which results from improper installation of security headers and the unauthorised execution of content. A browser will try to get a resource MIME type by content rather than just the Content-Type header. A server sends that header along with a resource. This behaviour can be stopped with the help of the X-Content-Type-Options HTTP header adding to the security fortification. A developer will instruct a browser to firmly follow the defined Content-type and disallow MIME sniffing by this header. The following discussion will provide insights ... Read More

Read Data from Scanner to an Array in Java

Revathi Satya Kondra
Updated on 17-Dec-2024 23:10:17

13K+ Views

The Scanner class of the java.util package gives you methods like nextInt(), nextByte(), nextFloat(), etc., to read data from the keyboard. To read an element of an array, use these methods in a 'for' loop. Let us have a brief explanation of the methods of nextInt(), nextByte(), and nextFloat() from the Scanner class in Java. Reading Integer Data Using nextInt() Method The nextInt() method is used to read the next token from the input as an integer. It is commonly used for reading integer values from the keyboard. Example In the following example, we use the nextInt() method of the ... Read More

Difference Between PATH and CLASSPATH in Java

Revathi Satya Kondra
Updated on 17-Dec-2024 23:03:52

1K+ Views

In Java, the terms Path and ClassPath refer to different things and are used for different purposes. Let's discuss them one by one with a suitable example − Path The path environment variable is used to specify the set of directories that contains execution programs. When you try to execute a program from the command line, the operating system searches for the specified program in the current directory and, if available, executes it. In case the programs are not available in the current directory, the operating system verifies in the set of directories specified in the 'PATH' environment variable. Setting ... Read More

Floating Point Hexadecimal in Java

Revathi Satya Kondra
Updated on 17-Dec-2024 23:03:20

573 Views

In this article, we use the '%a' format specifier to represent floating-point numbers in their hexadecimal form. This is useful when you need precise control over the representation of floating-point values. For Formatter, import the following package − import java.util.Formatter; Now creating a 'Formatter'object to format the data− Formatter f = new Formatter(); Using the format() method with the %a format specifier to convert a floating-point number to its hexadecimal string.− f.format("%a", 298.45) Example 1: Basic Example In this example, we format the floating-point number '298.45' to its hexadecimal representation using the '%a' format specifier with a 'Formatter' object ... Read More

Split and Join a String in Java

AmitDiwan
Updated on 17-Dec-2024 23:02:34

5K+ Views

Splitting and join a string To split and join a string in Java, use the split() and join() method as in the below example − Example A class named 'Demo' contains the main function. Here a String object is defined and split based on the '_' value up to the last word. A 'for' loop is iterated over, and the string is split based on the '_' value. Again, the string is joined using the 'join' function, and the output is displayed. public class Demo{ public static void main(String args[]){ String ... Read More

Check Whether Product of N Numbers is Even or Odd in Python

Akshitha Mote
Updated on 17-Dec-2024 15:57:36

598 Views

In this article, we try to find different methods to solve a problem to check whether the product of n numbers is even or odd. A number that is divisible by 2 is known as an even number. otherwise; it is an odd number. For example, 14 and 12 are two even numbers, the product is 168 is an even number. 9 and 5 are two odd numbers, the product is 45 is an odd number. Consider one even number 2 and one odd number 3, product of these two numbers is 6 an even number. Facts to Check if ... Read More

Advertisements