Arnab Chakraborty has Published 4293 Articles

Check whether the given string is a valid identifier in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 16-Jan-2021 04:56:34

861 Views

Suppose we have a string representing an identifier. We have to check whether it is valid or not. There are few criteria based on which we can determine whether it is valid or not.It must start with underscore '_' or any uppercase or lowercase lettersIt does not contain any whitespaceAll ... Read More

Check whether the given numbers are Cousin prime or not in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 16-Jan-2021 04:55:30

336 Views

Suppose we have a pair of integers. We have to check whether they are cousin primes or not. Two numbers are said to be cousin primes when both are primes and differ by 4.So, if the input is like pair = (19, 23), then the output will be True as ... Read More

Check whether the given number is Wagstaff prime or not in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 16-Jan-2021 04:53:55

143 Views

Suppose we have a number n. We have to check whether n is Wagstaff prime or not. As we know Wagstaff prime is a prime number which is in the following form.where q is an odd prime number.So, if the input is like n = 683, then the output will ... Read More

Check whether the given number is Euclid Number or not in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 16-Jan-2021 04:52:49

237 Views

Suppose we have a number n. We have to check whether n is Euclid number or not. As we know Euclid numbers are integer which can be represented as n= Pn+1where  is product of first n prime numbers.So, if the input is like n = 211, then the output will be ... Read More

Check whether the frequencies of all the characters in a string are prime or not in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 16-Jan-2021 04:51:17

220 Views

Suppose we have a string s. We have to check whether the occurrences of each character in s is prime or notSo, if the input is like s = "apuuppa", then the output will be True as there are two 'a's, three 'p's and two 'u's.To solve this, we will ... Read More

Check whether the Average Character of the String is present or not in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 16-Jan-2021 04:49:09

125 Views

Suppose we have a string s that contains alphanumeric characters, we have to check whether the average character of the string is present or not, if yes then return that character. Here the average character can be found by taking floor of average of each character ASCII values in s.So, ... Read More

Check whether sum of digits at odd places of a number is divisible by K in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 16-Jan-2021 04:48:35

125 Views

Suppose we have a number n and another number k, we have to check whether the sum of digits of n at it's odd places (from right side to left side) is divisible by k or not.So, if the input is like n = 2416 k = 5, then the ... Read More

Check whether second string can be formed from characters of first string in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 16-Jan-2021 04:46:51

493 Views

Suppose we have two strings s and t. We have to check whether t can be formed using characters of s or not.So, if the input is like s = "owleh" t = "hello", then the output will be True.To solve this, we will follow these steps −freq := a ... Read More

Check if a number can be expressed as a^b in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 16-Jan-2021 04:46:15

369 Views

Suppose we have a number n. We have to check whether we can make express it like a^b or not.So, if the input is like 125, then the output will be True as 125 = 5^3, so a = 5 and b = 3To solve this, we will follow these ... Read More

Check whether right angled triangle is valid or not for large sides in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 16-Jan-2021 04:45:16

738 Views

Suppose we have three sides in a list. We have to check whether these three sides are forming a right angled triangle or not.So, if the input is like sides = [8, 10, 6], then the output will be True as (8^2 + 6^2) = 10^2.To solve this, we will ... Read More

Advertisements