human
Minimum possible number with the given operation | Function to return the minimum possible integer that can be obtained from the given integer after performing the given operations.
For every digit.
Digits less than 5 need not to be changed as changing them will lead to a larger number.
The resulting integer cannot have leading zero.
Driver code"
How can the above be solved in Python?
 Write me a code to minimum possible number with the given operation and the other steps required?
assistant
#Here is code to minimum possible number with the given operation and the other steps required.
 def minInt ( str1 ) :
	for i in range ( len ( str1 ) ) :
		if ( str1 [ i ] >= 5 ) :
			str1 [ i ] = ( 9 - str1 [ i ] )
	if ( str1 [ 0 ] == 0 ) :
		str1 [ 0 ] = 9
	temp = " "
	for i in str1 :
		temp += str ( i )
	return temp
str1 = "589"
str1 = [ int ( i ) for i in str1 ]
print ( minInt ( str1 ) )