human
Check whether given floating point number is even or odd | Function to check even or odd ..
Loop to traverse number from LSB.
We ignore trailing 0 s after dot.
If it is ' . ' we will check next digit and it means decimal part is traversed ..
If digit is divisible by 2 means even number ..
Driver Function"
How can the above be solved in Python?
assistant
#Here is code to check whether given floating point number is even or odd and the other steps required.
 def isEven ( s ) :
	l = len ( s )
	dotSeen = False
	for i in range ( l - 1 , - 1 , - 1 ) :
		if ( s [ i ] == '0' and dotSeen == False ) :
			continue
		if ( s [ i ] == ' . ' ) :
			dotSeen = True
			continue
		if ( ( int ) ( s [ i ] ) % 2 == 0 ) :
			return True
		return False
s = "100.70"
if ( isEven ( s ) ) :
	print ( " Even " )
else :
	print ( " Odd " )