human
Find the single digit sum of alphabetical values of a string | Python program for the above approach.
Traverse the given string.
If character is an alphabet.
Stores the sum of order of values.
Find the score.
Find the single digit sum.
Return the resultant sum.
Driver Code"
How can the above be solved in Python?
 ... Can you provide a code to find the single digit sum of alphabetical values of a string and the other steps required?
assistant
#Here is code to find the single digit sum of alphabetical values of a string and the other steps required.
 def findTheSum ( str ) :
	alpha = " "
	for i in range ( 0 , len ( str ) ) :
		if ( ( str [ i ] >= ' A ' and str [ i ] <= ' Z ' ) or ( str [ i ] >= ' a ' and str [ i ] <= ' z ' ) ) :
			alpha += str [ i ]
	score = 0
	n = 0
	for i in range ( 0 , len ( alpha ) ) :
		if ( alpha [ i ] >= ' A ' and alpha [ i ] <= ' Z ' ) :
			score += ord ( alpha [ i ] ) - ord ( ' A ' ) + 1
		else :
			score += ord ( alpha [ i ] ) - ord ( ' a ' ) + 1
	while ( score > 0 or n > 9 ) :
		if ( score == 0 ) :
			score = n
			n = 0
		n += score % 10
		score = score // 10
	return n
if __name__ == " _ _ main _ _ " :
	S = " GeeksforGeeks "
	print ( findTheSum ( S ) )