
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 33676 Articles for Programming

279 Views
To return the cumulative sum of array elements over a given axis treating NaNs as zero, use the nancumprod() method. The cumulative sum does not change when NaNs are encountered and leading NaNs are replaced by zeros. Zeros are returned for slices that are all-NaN or empty.The method returns a new array holding the result unless out is specified, in which it is returned. The result has the same size as a, and the same shape as a if axis is not None or a is a 1-d array. Cumulative works like, 5, 5+10, 5+10+15, 5+10+15+20. The 1st parameter is ... Read More

157 Views
To compute the Hyperbolic cosine of the array elements, use the numpy.cosine() method in Python Numpy. The method is equivalent to 1/2 * (np.exp(x) + np.exp(-x)) and np.cos(1j*x). Returns the corresponding hyperbolic cosine values. This is a scalar if x is a scalar. The 1st parameter, x is input array. The 2nd and 3rd parameters are optional.The 2nd parameter is an ndarray, A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly-allocated array is returned.The 3rd parameter is the condition is broadcast over ... Read More

12K+ Views
In this article, we will understand how to print X star pattern using Java. The pattern is formed by using multiple for-loops and print statements. The pattern forms the shape of the letter "X" by printing stars ('X') and spaces in specific positions. The user can provide a number as input, which will determine the size of the pattern. The program uses nested loops to create the required star pattern, where stars are placed at the diagonal positions of a grid. Problem Statement Write a program in Java to print X star pattern. Below is a demonstration of the same: ... Read More

146 Views
To get the machine limits information for float types, use the numpy.finfo() method in Python Numpy. The first parameter is the float i.e. the kind of float data type to get information about.StepsAt first, import the required library −import numpy as npThe min is the minimum value of given dtype and max is the minimum value of given dtype.Checking for float16 type with instances −a = np.finfo(np.float16(12.5)) print("Minimum of float16 type...", a.min) print("Maximum of float16 type...", a.max)Checking for float32 type with instances −b = np.finfo(np.float32(30.5)) print("Minimum of float32 type...", b.min) print("Maximum of float32 type...", b.max)Checking for float type with instances ... Read More

196 Views
To return an array with the number of non-overlapping occurrences of substring, use the numpy.char.count() method in Python Numpy. The first parameter is the sub i.e. the substring to search for. The numpy.char module provides a set of vectorized string operations for arrays of type numpy.str_StepsAt first, import the required library −import numpy as npCreate a One-Dimensional array of strings −arr = np.array(['kATIE', 'JOHN', 'KAte', 'AmY', 'BRADley'])Displaying our array −print("Array...", arr)Get the datatype −print("Array datatype...", arr.dtype) Get the dimensions of the Array −print("Array Dimensions...", arr.ndim)Get the shape of the Array −print("Our Array Shape...", arr.shape)Get the number of elements of the ... Read More

1K+ Views
In this article, we will understand how to print half diamond star pattern. The pattern is formed by using multiple for-loops and print statements.Below is a demonstration of the same −InputSuppose our input is −Enter the number of rows : 8OutputThe desired output would be −The half diamond pattern : * ** *** **** ***** ****** ******* ******** ******* ****** ***** **** *** ** *AlgorithmStep 1 - START Step 2 - Declare three integer values namely i, j and my_input Step 3 - Read the required values from the user/ define the values Step 4 - We iterate through two ... Read More

2K+ Views
To round to nearest integer towards zero, use the numpy.fix() method in Python Numpy. It rounds an array of floats element-wise to nearest integer towards zero. The rounded values are returned as floats. The 1st parameter, x is an array of floats to be rounded. The 2nd parameter, out is a location into which the result is stored. If provided, it must have a shape that the input broadcasts to. If not provided or None, a freshly-allocated array is returned.The method returns a float array with the same dimensions as the input. If second argument is not supplied then a ... Read More

5K+ Views
In this article, we will understand how to print hollow right triangle star pattern. The pattern is formed by using multiple for-loops and print statements. For the pyramid at the first line it will print one star, and at the last line it will print n number of stars. For other lines it will print exactly two stars at the start and end of the line, and there will be some blank spaces between these two starts.Below is a demonstration of the same −InputSuppose our input is −Enter the size : 8OutputThe desired output would be −The hollow pyramid triangle ... Read More

193 Views
Suppose we have an array A with N elements. Consider there are N cats and they are numbered from 1 to N. Each cat is wearing a hat and ith cat says "there are exactly A[i] number of different colors among the N-1 hats owned by the cats except me". We have to check whether there exists a sequence of colors of the hats which is consistent with the remarks of the cats.So, if the input is like A = [1, 2, 2], then the output will be True, because if cat 1, 2 and 3 wears hats in colors ... Read More

232 Views
Suppose we have a number N. A cake seller is selling cakes with 40 rupees, and doughnuts with 70 rupees each. We have to check whether we can buy some of them with exactly N rupees or not.So, if the input is like N = 110, then the output will be True, because 40 + 70 = 110.To solve this, we will follow these steps −o := false Define a function dfs(), this will take i, if i > n, then: return false if i is same as n, then: return true if dfs(i + 40), then: ... Read More