Found 34494 Articles for Programming

Is there any difference between int[] a and int a[] in Java?

Shriansh Kumar
Updated on 17-Aug-2023 09:39:59

288 Views

Array is a linear data structure that is used to store a group of elements with similar datatypes. It stores data in a sequential manner. Once we create an array we can't change its size i.e. it is of fixed length. There are various ways to create an array named 'a[]' of type integer including 'int[] a' and 'int a[]'. But, the question that pops up here is that is there any difference between these two syntaxes and which one is preferable. Stick with us till the end of this article to find out the answer to these questions. How ... Read More

Intermediate Methods of Stream in Java

Shriansh Kumar
Updated on 17-Aug-2023 09:37:00

673 Views

In Java, the streams allow us to perform the functional operations on the specified element. It simply channelizes the elements of source such as arrays, files and classes of collection framework, through various built-in methods to return the result. These built-in methods could be intermediate or terminal. In this article, we are going to explore some intermediate methods of Stream, such as map, filter, reduce, and collect. These methods help us to manipulate and process data. Intermediate Methods of Java Streams The methods of Java Streams are collectively called as a higher-order function, which further classified as − Intermediate ... Read More

How to iterate over Columns in Numpy

Tapas Kumar Ghosh
Updated on 16-Aug-2023 16:15:40

993 Views

The name Numpy stands for Numerical Python. It helps to solve the mathematical operation on an array. In Python, we have some built-in functions such as nditor(), T(), array(), shape[], and apply_along_axis() that will be used to iterate over columns in Numpy. Syntax The following syntax is used in the examples- nditer() The NumPy module contains this built-in function for iterator objects. T() This function refers to transposing of the index in a column dataframe. array() This is a built-in function in Python that creates the array. An array is defined by collecting the items of ... Read More

Python - K Elements Reversed Slice

Tapas Kumar Ghosh
Updated on 16-Aug-2023 16:11:56

99 Views

The reverse slice is defined by creating a slice that begins with the length of the string and ends with the 0th index. For reversing the list element it will use the negative value notation, where we can get a reversed order of the original list element. In Python, we have some built-in functions such as append(), len(), and, range() will be used to solve the K elements Reversed Slice. Syntax The following syntax is used in the examples- append() This built-in method in Python can be used to add the element at the end of the list. len() ... Read More

How to set up pygame with Eclipse?

Tapas Kumar Ghosh
Updated on 16-Aug-2023 16:14:00

159 Views

The pygame is the name of the module of Python that helps to build the code for graphics such as rectangles, squares, circles, etc. It is also used the write the code for animation programs in Python. Eclipse is famous for Java IDE but here we have to set the environment of Python to run the program based on Pygame. System requirement Memory: 4 GB CPU: Intel Core i5 Storage: 30GB prefer to be good Operating System: windows 7/10/11 Steps to set up pygame with Eclipse The following syntax is used in the examples- Step 1: Start searching ... Read More

Python - Filter unequal elements of two lists corresponding same index

Tapas Kumar Ghosh
Updated on 16-Aug-2023 16:20:05

289 Views

The indexing is the specific position of the element from the list. The unequal elements of two lists refer to those indexes whose elements are not matched from both lists. In Python, we have some built-in functions like enumerate(), zip(), filter(), etc. that can be used to filter unequal elements of two lists corresponding same index. Let’s take an example of this Given list, lst_1 = [10, 20, 30, 40, 50] lst_2 = [1, 20, 3, 40, 50] Then the final result becomes [20, 40, 50] these elements from the list matches the corresponding same index. Syntax The following syntax ... Read More

Finding Words with both Alphabet and Numbers using Python

Tapas Kumar Ghosh
Updated on 16-Aug-2023 16:09:25

376 Views

Python refers to the high-level programming language that has various tools and built-in functions to analyze text data. This problem statement is a common task that uses some built-in functions- filter(), isdigit(), isalpha(), findall(), split(), and, append() to find the both alphabet and numbers using Python. Let’s see how to take the input of the program to get the result: Input my_text = "WELCOME TO CLUB100" Output CLUB100 Syntax The following syntax is used in the examples- filter() The filter() method is applied when it filter the items based on specific conditions. In simple terms, it allows ... Read More

Python - Find first Element by Second in Tuple List

Tapas Kumar Ghosh
Updated on 16-Aug-2023 16:07:16

292 Views

The tuple list defines the two different datatypes of Python that represent the static and dynamic characteristics respectively. In a dictionary, we can create keys using tuples whereas lists cannot be used as keys. In Python, we have some built-in functions like next(), items(), index(), lambda, and, min() will be used to Find the first element by the second in the tuple list. This type of circumstance occurs when the second element holds the important information as a key for identifying the desired tuple. Let’s take an example of this: The given tuple list, my_tup = [("India", 35), ("Indonesia", 12), ... Read More

Convert Matrix to Coordinate Dictionary in Python

Tapas Kumar Ghosh
Updated on 16-Aug-2023 16:04:40

242 Views

The dictionary is one of the most popular among four datatypes known for unordered collection of key-value pairs. The Python matrix will be used to represent the list of lists whereas an inner list represents the row-value of a matrix. A coordinate dictionary is defined as tuples to set the rows and columns by giving coordinates value. In Python, we have some built-in functions such as len(), range(), zip(), etc. that can be used to solve Convert Matrix to Coordinate dictionary. Syntax The following syntax is used in the examples- len() The len() is a built-in method in Python ... Read More

Python- Find the indices for k Smallest Elements

Tapas Kumar Ghosh
Updated on 16-Aug-2023 16:03:09

204 Views

The indices are the position of the elements present in the list whereas K defines the specific value to target the smallest element from the list. Sometimes, we are working in the field of web development and database these tasks generally occur to solve this problem statement. In Python, we have built-in functions like sorted(), range(), len(), etc. that will be used to find the indices for k Smallest elements. Syntax The following syntax is used in the examples- sorted() The sorted() is an in-built function in Python that helps to return the new sorted list while ... Read More

Advertisements