human
Remove trailing zeros from the sum of two numbers ( Using Stack ) | Function to remove trailing zeros from the sum of two numbers.
Stores the sum of A and B.
Stores the digits.
Stores the equivalent string of integer N.
Traverse the string.
Push the digit at i in the stack.
While top element is '0.
Pop the top element.
Stores the resultant number without tailing 0 's.
While s is not empty.
Append top element of S in res.
Pop the top element of S.
Reverse the string res.
Driver Code.
Input.
Function Call"
How can the above be solved in Python?
 ... Write me a code to remove trailing zeros from the sum of two numbers ( Using Stack ) and the other steps required?
assistant
#Here is code to remove trailing zeros from the sum of two numbers ( Using Stack ) and the other steps required.
 def removeTailing ( A , B ) :
	N = A + B
	s = [ ]
	strsum = str ( N )
	for i in range ( len ( strsum ) ) :
		s . append ( strsum [ i ] )
'
	while ( s [ - 1 ] == '0' ) :
		s . pop ( )
	res = " "
	while ( len ( s ) != 0 ) :
		res = res + ( s [ - 1 ] )
		s . pop ( )
	res = list ( res )
	res . reverse ( )
	res = ' ' . join ( res )
	return res
if __name__ == " _ _ main _ _ " :
	A = 130246
	B = 450164
	print ( removeTailing ( A , B ) )