human
Remove repeated digits in a given number | Python 3 program to remove repeated digits.
Store first digits as previous digit.
Initialize power.
Iterate through all digits of n , note that the digits are processed from least significant digit to most significant digit ..
Store current digit.
Add the current digit to the beginning of result.
Update previous result and power.
Remove last digit from n.
Driver Code"
How can the above be solved in Python?
assistant
#Here is code to remove repeated digits in a given number and the other steps required.
 def removeRecur ( n ) :
	prev_digit = n % 10
	pow = 10
	res = prev_digit
	while ( n ) :
		curr_digit = n % 10
		if ( curr_digit != prev_digit ) :
			res += curr_digit * pow
			prev_digit = curr_digit
			pow *= 10
		n = int ( n / 10 )
	return res
if __name__ == ' _ _ main _ _ ' :
	n = 12224
	print ( removeRecur ( n ) )