human
Program to convert Number in characters | Python3 program to convert number in characters.
To calculate the reverse of the number.
The remainder will give the last digit of the number.
Extract the first digit of the reversed number.
Match it with switch case.
Divide the number by 10 to get the next number.
Driver code"
How can the above be solved in Python?
assistant
#Here is code to program to convert Number in characters and the other steps required.
 def NumbertoCharacter ( n ) :
	rev = 0 ; r = 0 ;
	while ( n > 0 ) :
		r = n % 10 ;
		rev = rev * 10 + r ;
		n = n // 10 ;
	while ( rev > 0 ) :
		r = rev % 10 ;
		switcher = { 0 : " zero ▁ " , 1 : " one ▁ " , 2 : " two ▁ " , 3 : " three ▁ " , 4 : " four ▁ " , 5 : " five ▁ " , 6 : " six ▁ " , 7 : " seven ▁ " , 8 : " eight ▁ " , 9 : " nine ▁ " }
		print ( switcher . get ( r , " UnValid " ) , end = " ▁ " ) ;
		rev = rev // 10 ;
if __name__ == ' _ _ main _ _ ' :
	n = 12345 ;
	NumbertoCharacter ( n ) ;