human
Find the sum of digits of a number at even and odd places | Function to find the sum of the odd and even positioned digits in a number.
If n is odd then the last digit will be odd positioned.
To store the respective sums.
While there are digits left process.
If current digit is odd positioned.
Even positioned digit.
Invert state.
Remove last digit.
Driver code"
Solution in Python:
 ... Can you provide a code to find the sum of digits of a number at even and odd places and the other steps required?
assistant
#Here is code to find the sum of digits of a number at even and odd places and the other steps required.
 def getSum ( n ) :
	if ( n % 2 == 1 ) :
		isOdd = True
	else :
		isOdd = False
	sumOdd = 0
	sumEven = 0
	while ( n != 0 ) :
		if ( isOdd ) :
			sumOdd += n % 10
		else :
			sumEven += n % 10
		isOdd = not isOdd
		n //= 10
	print ( " Sum ▁ odd ▁ = ▁ " , sumOdd )
	print ( " Sum ▁ even ▁ = ▁ " , sumEven )
if __name__ == " _ _ main _ _ " :
	n = 457892
	getSum ( n )