human
Find first and last digits of a number | Find the first digit.
Remove last digit from number till only one digit is left.
return the first digit.
Find the last digit.
return the last digit.
Driver Code"
Solution in Python:
 Give me a code to find first and last digits of a number and the other steps required?
assistant
#Here is code to find first and last digits of a number and the other steps required.
 def firstDigit ( n ) :
	while n >= 10 :
		n = n / 10 ;
	return int ( n )
def lastDigit ( n ) :
	return ( n % 10 )
n = 98562 ;
print ( firstDigit ( n ) , end = " ▁ " )
print ( lastDigit ( n ) )