Nikhitha Chowdary Manne

Nikhitha Chowdary Manne

7 Articles Published

Articles by Nikhitha Chowdary Manne

7 articles

Python program to print an Array

Nikhitha Chowdary Manne
Nikhitha Chowdary Manne
Updated on 27-Mar-2026 3K+ Views

In Python, an array (or list) is a collection of elements stored in a single variable with contiguous memory locations. Each element can be accessed using its index, which starts from 0 for the first element. Python lists are dynamic and can store homogeneous elements of the same datatype. The index represents the position of each element, ranging from 0 to n-1 for an array with n elements. Array Indexing Array indices are the position numbers used to access elements. The first element is at index 0, the second at index 1, and so on. For an ...

Read More

Python Program to Sort the 2D Array Across Columns

Nikhitha Chowdary Manne
Nikhitha Chowdary Manne
Updated on 27-Mar-2026 3K+ Views

When a two-dimensional array or a 2D array is declared, it is treated like a matrix with rows and columns. Sorting a 2D array across columns means sorting the elements within each column independently, either in ascending or descending order. Understanding Column-wise Sorting Consider this 2D array ? import numpy as np # Original 2D array arr = [[7, 9, 5, 7], [9, 5, 9, 4], [2, 7, 8, 6], [8, ...

Read More

Python Program to Remove Duplicate Elements From an Array

Nikhitha Chowdary Manne
Nikhitha Chowdary Manne
Updated on 27-Mar-2026 2K+ Views

An array is a collection of elements of the same data type, where each element is identified by an index value. It is the simplest data structure where each data element can be accessed directly using its index number. Arrays in Python Python does not have a specific data structure to represent arrays. Here, we can use a List as an array ? [6, 4, 1, 5, 9] 0 1 2 3 4 The indexing in Python starts from 0. In the above example, the integers 6, 4, 1, ...

Read More

Python Program to Remove All Occurrences of an Element in an Array/List

Nikhitha Chowdary Manne
Nikhitha Chowdary Manne
Updated on 27-Mar-2026 5K+ Views

An array is a collection of elements of homogeneous datatypes stored in contiguous memory locations. Python does not provide built-in arrays, but you can use lists or import the array module. Lists are more flexible as they can contain different data types. The task is to remove all occurrences of a specific element from a list, including duplicates. Let's explore different approaches to accomplish this ? Input Output Scenario Consider a list with repeated elements ? my_list = [1, 10, 20, 10, 21, 16, 18, 10, 22, 10, 8, 10] print("Original list:", my_list) print("Element 10 ...

Read More

Python program to print the Boundary elements of a Matrix

Nikhitha Chowdary Manne
Nikhitha Chowdary Manne
Updated on 27-Mar-2026 879 Views

The boundary elements of a matrix are elements located on the outer edges: first row, last row, first column, or last column. These elements form the perimeter of the matrix. Understanding Boundary Elements Consider this 3×3 matrix ? 9 8 7 6 5 4 3 2 1 The boundary elements are: 9, 8, 7, 6, 4, 3, 2, 1. The middle element 5 is not a boundary element since it's surrounded by other elements. Algorithm Step 1 − Traverse the matrix using nested loops (outer ...

Read More

Python program to find common array elements

Nikhitha Chowdary Manne
Nikhitha Chowdary Manne
Updated on 27-Mar-2026 337 Views

Finding common elements in arrays is a frequent task in data processing. Python provides several approaches depending on whether you're working with multi-dimensional arrays or comparing separate arrays. Finding Common Elements in Multi-Dimensional Arrays For multi-dimensional arrays, we can use the intersection_update() method with sets to find elements that appear in all sub-arrays ? Input Output Scenario Consider a 2D array with multiple sub-arrays ? arr = [[1, 2, 3, 4], [3, 4, 5, 6], [7, 8, 3, 4], [4, 9, 8, 3], [4, 3, 10, 12]] # Elements 3 and 4 appear ...

Read More

Python Program to Check if two arrays are equal

Nikhitha Chowdary Manne
Nikhitha Chowdary Manne
Updated on 27-Mar-2026 23K+ Views

Arrays are fundamental data structures in Python, and checking if two arrays are equal is a common operation. Python provides several techniques to compare arrays based on whether they contain the same elements, regardless of order. Understanding Array Equality Array equality can be checked in two ways: Element-wise comparison − Same elements at same positions Set-based comparison − Same elements regardless of order Let's explore different methods to check array equality ? Method 1: Using NumPy for Element-wise Comparison NumPy's array_equal() function compares arrays element by element ? import numpy ...

Read More
Showing 1–7 of 7 articles
« Prev 1 Next »
Advertisements