human
Write me a code to find nth Magic Number and the other steps required given the following:
Find nth Magic Number | Function to find nth magic number.
Go through every bit of n.
If last bit of n is set.
proceed to next bit n >>= 1 or n = n / 2.
Driver program to test above function"
How can the above be solved in Python?
assistant
#Here is code to find nth Magic Number and the other steps required.
 def nthMagicNo ( n ) :
	pow = 1
	answer = 0
	while ( n ) :
		pow = pow * 5
		if ( n & 1 ) :
			answer += pow
	return answer
n = 5
print ( " nth ▁ magic ▁ number ▁ is " , nthMagicNo ( n ) )