human
What is a code to find the greater number closest to N having at most one non and the other steps required given the following:
Find the greater number closest to N having at most one non | Function to get closest greater number with at most non zero digit.
Stores the closest greater number with at most one non - zero digit.
Stores length of str.
Append 10 to the end of resultant String.
Append n - 1 times '0' to the end of resultant String.
Driver Code"
How can the above be solved in Python?
assistant
#Here is code to find the greater number closest to N having at most one non and the other steps required.
 def closestgtNum ( str ) :
	res = " " ;
	n = len ( str ) ;
	if ( str [ 0 ] < '9' ) :
		res += ( chr ) ( ord ( str [ 0 ] ) + 1 ) ;
	else :
		res += ( chr ) ( '1' ) ;
		res += ( chr ) ( '0' ) ;
	for i in range ( n - 1 ) :
		res += ( '0' ) ;
	return res ;
if __name__ == ' _ _ main _ _ ' :
	str = "120" ;
	print ( closestgtNum ( str ) ) ;