human
Can you provide a code to convert the number from International system to Indian system and the other steps required given the following:
Convert the number from International system to Indian system | Function to convert a number represented in International numeric system to Indian numeric system ..
Find the length of the input string.
Removing all the separators ( , ) from the input string.
Reverse the input string.
Declaring the output string.
Process the input string.
Add a separator ( , ) after the third number.
Then add a separator ( , ) after every second number.
Reverse the output string.
Return the output string back to the main function.
Driver code"
Solution in Python:
assistant
#Here is code to convert the number from International system to Indian system and the other steps required.
 def convert ( input ) :
	Len = len ( input )
	i = 0
	while ( i < Len ) :
		if ( input [ i ] == " , " ) :
			input = input [ : i ] + input [ i + 1 : ]
			Len -= 1
			i -= 1
		elif ( input [ i ] == " ▁ " ) :
			input = input [ : i ] + input [ i + 1 : ]
			Len -= 1
			i -= 1
		else :
			i += 1
	input = input [ : : - 1 ]
	output = " "
	for i in range ( Len ) :
		if ( i == 2 ) :
			output += input [ i ]
			output += " ▁ , "
		elif ( i > 2 and i % 2 == 0 and i + 1 < Len ) :
			output += input [ i ]
			output += " ▁ , "
		else :
			output += input [ i ]
	output = output [ : : - 1 ]
	return output
input1 = "123 , ▁ 456 , ▁ 789"
input2 = "90 , ▁ 050 , ▁ 000 , ▁ 000"
print ( convert ( input1 ) )
print ( convert ( input2 ) )