human
Find position of given term in a series formed with only digits 4 and 7 allowed | Function to find the position of the number N.
To store the position of N.
Iterate through all digit of N.
If current digit is 7.
If current digit is 4.
Print the final position.
Driver Code.
Given number of the series.
Function Call"
Solution in Python:
 Give me a code to find position of given term in a series formed with only digits 4 and 7 allowed and the other steps required?
assistant
#Here is code to find position of given term in a series formed with only digits 4 and 7 allowed and the other steps required.
 def findPosition ( n ) :
	i = 0
	pos = 0
	while ( n > 0 ) :
		if ( n % 10 == 7 ) :
			pos = pos + pow ( 2 , i + 1 )
		else :
			pos = pos + pow ( 2 , i )
		i += 1
		n = n // 10
	print ( pos )
if __name__ == ' _ _ main _ _ ' :
	N = 777
	findPosition ( N )