human
Give me a code to find one extra character in a string and the other steps required given the following:
Find one extra character in a string | Python Program to find extra character in one string.
Determine string with extra character.
Add Character codes of both the strings.
Add last character code of large string.
Minus the character code of smaller string from the character code of large string The result will be the extra character code.
Driver code"
How can the above be solved in Python?
assistant
#Here is code to find one extra character in a string and the other steps required.
 def findExtraCharacter ( s1 , s2 ) :
	smallStr = " "
	largeStr = " "
	if ( len ( s1 ) > len ( s2 ) ) :
		smallStr = s2
		largeStr = s1
	else :
		smallStr = s1
		largeStr = s2
	smallStrCodeTotal = 0
	largeStrCodeTotal = 0
	i = 0
	while ( i < len ( smallStr ) ) :
		smallStrCodeTotal += ord ( smallStr [ i ] )
		largeStrCodeTotal += ord ( largeStr [ i ] )
		i += 1
	largeStrCodeTotal += ord ( largeStr [ i ] )
	intChar = largeStrCodeTotal - smallStrCodeTotal
	return chr ( intChar )
s1 = " abcd "
s2 = " cbdae "
extraChar = findExtraCharacter ( s1 , s2 )
print ( " Extra ▁ Character : " , extraChar )