human
Count strings having sum of ASCII values of characters equal to a Prime or Armstrong Number | Function to check if a number is prime number.
Define a flag variable.
Check for factors of num.
If factor is found , set flag to True and break out of loop.
Check if flag is True.
Function to calculate order of the number x.
Function to check whether the given number is Armstrong number or not.
If the condition satisfies.
Function to count Armstrong valued strings.
Stores the count of Armstrong valued strings.
Iterate over the list.
Store the value of the string.
Find value of the string.
Check if it an Armstrong number.
Function to count prime valued strings.
Store the count of prime valued strings.
Iterate over the list.
Store the value of the string.
Find value of the string.
Check if it is a Prime Number.
Driver code.
Function Call"
Solution in Python:
assistant
#Here is code to count strings having sum of ASCII values of characters equal to a Prime or Armstrong Number and the other steps required.
 def isPrime ( num ) :
	flag = False
	if num > 1 :
		for i in range ( 2 , num ) :
			if ( num % i ) == 0 :
				flag = True
				break
	if flag :
		return False
	else :
		return True
def order ( x ) :
	n = 0
	while ( x != 0 ) :
		n = n + 1
		x = x // 10
	return n
def isArmstrong ( x ) :
	n = order ( x )
	temp = x
	sum1 = 0
	while ( temp != 0 ) :
		r = temp % 10
		sum1 = sum1 + r ** n
		temp = temp // 10
	return ( sum1 == x )
def count_armstrong ( li ) :
	c = 0
	for ele in li :
		val = 0
		for che in ele :
			val += ord ( che )
		if isArmstrong ( val ) :
			c += 1
	return c
def count_prime ( li ) :
	c = 0
	for ele in li :
		val = 0
		for che in ele :
			val += ord ( che )
		if isPrime ( val ) :
			c += 1
	return c
arr = [ " geeksforgeeks " , " a " , " computer " , " science " , " portal " , " for " , " geeks " ]
print ( " Number ▁ of ▁ Armstrong ▁ Strings ▁ are : " , count_armstrong ( arr ) )
print ( " Number ▁ of ▁ Prime ▁ Strings ▁ are : " , count_prime ( arr ) )