Found 33676 Articles for Programming

Python program to find Sum of a sublist

Vikram Chiluka
Updated on 31-Jan-2023 13:44:19

3K+ Views

In this article, we will learn a python program to find the sum of a sublist. Methods Used The following are the various methods to accomplish this task − Using For Loop(Brute Code) Using Cumulative Sum Method Using sum() Function Using math.fsum() Function Using For Loop (Brute Code) Algorithm (Steps) Following are the Algorithm/steps to be followed to perform the desired task. − Create a variable to store the input list. Create two separate variables for storing the start and the end indices. Initialize a variable resultSum to 0 for storing the resultant sum of a sublist. ... Read More

Python Program to Convert Singular to Plural

Vikram Chiluka
Updated on 01-Feb-2023 20:12:54

5K+ Views

In this article, we will learn a Python Program to Convert Singular to Plural. Assume you are given a singular word and we must convert it into plural using the various python methods. Methods Used The following are the various methods to accomplish this task − Using the regex module Using NLTK and Pattern-en Packages Using the Textblob module Using inflect module Method 1: Using the regex module The regex module in python searches for a string or group of strings based on a specified pattern. In case it doesn't already exist in your Python you must install ... Read More

Python Program to check Involutory Matrix

Vikram Chiluka
Updated on 31-Jan-2023 13:42:45

155 Views

In this article, we will learn a python program to check Involutory Matrix. Assume we have taken an input matrix. We will now check whether the input matrix is an Involutory Matrix using the below methods. Methos Used The following are the various methods to accomplish this task − Using Nested For Loop Using NumPy module What is an Involutory Matrix? If a matrix multiplies by itself and gives the identity matrix, it is said to be an involutory matrix. The matrix that is its inverse is the involutory matrix. If A * A = I, matrix A ... Read More

Python Program for Number of local extrema in an array

Vikram Chiluka
Updated on 31-Jan-2023 13:40:39

444 Views

In this article, we will learn a python program for a number of local extrema in an array. An extrema is an element that is either greater than or less than both of its neighbors. Assume we have taken an array containing n elements. We will now find the count of a number of local extrema in a specified input array. Note The first and last elements are not extrema. Using For loop NOTE Both array[0] and array[n-1] have only one neighbor each, hence they are neither minima nor maxima. len() − The number of items in an ... Read More

Additive Secret Sharing and Share Proactivization ñ Using Python

Farhan Muhamed
Updated on 11-Jul-2025 18:24:17

587 Views

Additive Secret Sharing and Share Proactivization are cryptographic techniques to share a password or other confidential data among a group of people. In this article, we will explain these techniques and implement Python code to demonstrate them. Additive Secret Sharing Additive secret sharing is a technique used in cryptography to share a secret string or a password among multiple parties, such that all of the parties must collaborate to reconstruct the secret. For example: Original Secret Key: 1234 Generated five Shares: [-488, -55, -417, -720, 2914] Reconstructed Secret: 1234 Explanation: The original secret password is split into 5 ... Read More

Check a Subarray is Formed by Consecutive Integers from a Given Array in Java

Mr. Satyabrata
Updated on 30-Jan-2023 16:49:28

736 Views

In Java, Array is an object. It is a non-primitive data type which stores values of similar data type. As per the problem statement we have to check if a sub array is formed by consecutive integers from a given array of integers. The sub array refers to some segment of the array from an array. Here it has been told to check the subarray formed by consecutive integers elements i.e., the array elements are a set of continuous numbers where we can get one after another element. Let’s explore the article to see how it can be done by ... Read More

Avoid These Mistakes While Learning Java

Mr. Satyabrata
Updated on 30-Jan-2023 16:37:51

231 Views

Java is one of the most popular programming languages in the world and is the language of choice for many developers and coders. With its wide variety of uses, including web development & mobile app development, it's no wonder that so many people are eager to learn how to work with Java. Java is used to develop various applications, from small desktop programs to large enterprise applications. Learning Java can be a great way to expand your skills and create applications that can have a real impact. The Unrivalled Versatility and Robustness of Java Java has become one of the ... Read More

Advantages and Disadvantages of Java Sockets

Satish Kumar
Updated on 30-Jan-2023 10:23:19

3K+ Views

Java Sockets are a powerful tool for creating network-based applications in the Java programming language. They allow for communication between different computers and devices, making it possible to create client-server applications, peer-to-peer networks, and other types of network-based systems. However, like any programming tool, Java Sockets have both advantages and disadvantages that need to be considered when designing and implementing network-based systems. Advantages of Java Sockets Platform Independence One of the biggest advantages of Java Sockets is that they are platform-independent. This means that the same Java code can be run on multiple operating systems and devices without the need ... Read More

Matrix and linear Algebra calculations in Python

Vikram Chiluka
Updated on 01-Feb-2023 20:10:57

1K+ Views

In this article, we will learn Matrix and linear Algebra calculations in Python such as matrix multiplication, finding determinants, solving linear equations, etc. A matrix object from the NumPy library can be used for this. When it comes to calculation, matrices are relatively comparable to the array objects Linear Algebra is a huge topic that is outside of this article. However, NumPy is an excellent library to start if you need to manipulate matrices and vectors. Methods Used Finding Transpose of a Matrix Using Numpy Finding Inverse of a Matrix Using Numpy Multiplying Matrix with a Vector ... Read More

Swift Program to remove the last given number of items from the array

Ankita Saini
Updated on 27-Jan-2023 12:38:26

265 Views

In this article, we will learn how to write a swift program to remove the last given number of items from the array. An array is used to store elements of same data type in an order. So, here we use the following methods to remove the last given number of items from the array − Using removeLast(_:) function Using dropLast(_:) function Using removeSubrange() function Method 1: Using removeLast(_:) Function Swift provide an in-built function named as removeLast() function to remove the specified number of items from the end of the array. Syntax func removeLast(_x: Int) ... Read More

Advertisements