human
Count the number of words having sum of ASCII values less than and greater than k | Function to count the words.
Sum of ascii values.
Number of words having sum of ascii less than k.
If character is a space.
Add the ascii value to sum.
Handling the Last word separately.
Driver code"
Solution in Python:
assistant
#Here is code to count the number of words having sum of ASCII values less than and greater than k and the other steps required.
 def CountWords ( str , k ) :
	sum = 0
	NumberOfWords = 0
	counter = 0
	l = len ( str )
	for i in range ( l ) :
		if ( str [ i ] == ' ▁ ' ) :
			if ( sum < k ) :
				counter += 1
			sum = 0
			NumberOfWords += 1
		else :
			sum += ord ( str [ i ] )
	NumberOfWords += 1
	if ( sum < k ) :
		counter += 1
	print ( " Number ▁ of ▁ words ▁ having ▁ sum ▁ of ▁ ASCII " , " values ▁ less ▁ than ▁ k ▁ = " , counter )
	print ( " Number ▁ of ▁ words ▁ having ▁ sum ▁ of ▁ ASCII ▁ values " , " greater ▁ than ▁ or ▁ equal ▁ to ▁ k ▁ = " , NumberOfWords - counter )
if __name__ == " _ _ main _ _ " :
	str = " Learn ▁ how ▁ to ▁ code "
	k = 400
	CountWords ( str , k )