Check If Input is an Integer or a String in C++

Sunidhi Bansal
Updated on 02-Nov-2023 13:08:18

43K+ Views

Given with an input by the user and the task is to check whether the given input is an integer or a string. Integer can be any combination of digits between 0 -9 and string can be any combination excluding 0 – 9. Example Input-: 123 Output-: 123 is an integer Input-: Tutorials Point Output-: Tutorials Point is a string Approach used below is as follows − Input the data. Apply isdigit() function that checks whether a given input is numeric character or not. This function takes single argument as an integer and also returns ... Read More

Unique Values Multiplication in Python

Pranay Arora
Updated on 02-Nov-2023 13:04:22

158 Views

List in python allows duplicate entries, that is we can have the same value twice in a list. That is useful in most cases, but sometimes there is a need to remove the duplicate elements to perform certain operations. In this article we will focus on how we can take up the unique values removing duplicates from a list of integers and finding their product. It has a wide use case scenario and we will try and discuss all possible ways to generate the output. Method 1: Set Implementation Set in python is unordered data collection that is iterable, mutable ... Read More

Unique Tuple Frequency Order Irrespective in Python

Pranay Arora
Updated on 02-Nov-2023 12:52:03

355 Views

In this article, we will have input as a list of tuples and our goal will be to print the frequency of unique tuples but it will be order irrespective. Order irrespective means that a tuple (1, 2, 3) and (1, 3, 2) will be treated as same even though their order is different. For example, consider the following − Input [(1, 2, 3), (2, 1, 3), (4, 5, 6), (1, 2, 3), (3, 2, 1)] Output 2 Explanation The tuples at index 0, 1, 3 and 4 are same and hence frequency count increases by ... Read More

Python Tuple Value Product in Dictionary

Pranay Arora
Updated on 02-Nov-2023 12:49:07

214 Views

Dictionaries in python are widely used, to store data in key-value pairs. Many times, we get stuck in finding the product of elements in the tuple received as value in the dictionary. This mostly arises in situations working with data manipulation or analysis. Through this article, we will code and understand various ways to unpack the dictionary and calculate the product of tuple elements at each index. Input {'a': (1, 3, 5, 7), 'b': (2, 4, 6, 8), 'c': (2, 3, 5, 7)} Output (4, 36, 150, 392) Method 1: Using Tuple Unpacking and zip() Function ... Read More

Invert Python Tuple Elements

Pranay Arora
Updated on 02-Nov-2023 12:33:44

400 Views

Python tuples store data in the form of individual elements. The order of these elements is fixed i.e (1, 2, 3) will remain in the same order of 1, 2, 3 always. In this article, we are going to see how to invert python tuple elements or in simple terms how to reverse the order of the elements. Let us 1st see a sample input and output − Input (5, 6, 7, 8) Output (8, 7, 6, 5) Let us now explore the various ways to invert tuple elements. Method 1: Using Tuple Slicing Slicing is ... Read More

Divide One Hermite Series by Another in Python using NumPy

Niharika Aitam
Updated on 02-Nov-2023 12:33:03

122 Views

The Hermite series is one of the mathematical techniques, which is used to represent the infinite series of Hermite polynomials. The Hermite polynomials referred as the sequence of orthogonal polynomials which are the solutions of the Hermite differential equation. Dividing one hermite series by another The Hermite series is given by the following equation. f(x) = Σn=0^∞ cn Hn(x) Where Hn(x) is the nth Hermite polynomial cn is the nth coefficient in the expansion. The coefficient cn can be determined by using the below formula: cn = (1/$\mathrm{\surd}$(2^n n!))$\mathrm{\lmoustache}$ f(x) Hn(x) e^(−x^2/2) dx Example ... Read More

Convert Lists into Similar Key-Value Lists in Python

Pranay Arora
Updated on 02-Nov-2023 12:31:36

200 Views

Given 2 separate lists, we are going to transform them into a single data structure by mapping them into a key-value data structure namely dictionary. The values of the 1st list will serve as keys and values from the 2nd list will serve as values of the corresponding keys in the dictionary. The relationship can be considered as 1 to 1 or 1 to many i.e. 1 key can have multiple values. Let us now see a sample input and output to better understand how we will be able convert Lists into Similar key value lists in Python in this ... Read More

Differentiate Hermite E Series and Set Derivatives in Python

Niharika Aitam
Updated on 02-Nov-2023 12:30:35

173 Views

Hermite_e series is also known as probabilist's Hermite polynomial or the physicist's Hermite polynomial the available in mathematics which is used to sum of the weighted hermites polynomials. In some particular cases of the quantum mechanics, the Hermite_e series the weight function is given as e^(−x^2). The following is the formula for Hermite_e series. H_n(x) = (-1)^n e^(x^2/2) d^n/dx^n(e^(-x^2/2)) Where, H_n(x) is the nth Hermite polynomial of degree n x is the independent variable d^n/dx^n denotes the nth derivative with respect to x. Defining the coefficients To perform differentiation of the Hermite_e series first we have ... Read More

Digital Band Reject Butterworth Filter in Python

Niharika Aitam
Updated on 02-Nov-2023 12:11:23

397 Views

A Band Reject filter is the filter which rejects or blocks all the frequencies within the range and passes the frequencies outside the range. The Butterworth is the type of a filter designed to filter the frequencies as flat as possible in the pass band. The following are the main features of the digital band reject butter worth filter. The sampling rate of the filter is about 12 kHz. The pass band edge frequencies are in the range of 2100 Hz to 4500 Hz. The stop band edge frequencies are within the range of 2700 Hz to 3900 ... Read More

Digital High Pass Butterworth Filter in Python

Niharika Aitam
Updated on 02-Nov-2023 12:06:28

1K+ Views

The high pass filter is the electronic filter which passes the frequency of signals greater than the defined cutoff frequency and the frequency of the signals lower than the cutoff will be attenuated. The attenuation of each frequency is based on the filter design. The High pass Butterworth filter has some specialized features defined as follows. The sampling rate of the given input signal is given as 3.5 kHz The edge frequency of the pass band is 1050 Hz The edge frequency of the stop band is 600 Hz The ripple of the pass band is 1 dB The ... Read More

Advertisements