human
Can you provide a code to largest and smallest digit of a number and the other steps required given the following:
Largest and smallest digit of a number | Function to the largest and smallest digit of a number.
Find the largest digit.
Find the smallest digit.
Driver code.
Function call"
How can the above be solved in Python?
assistant
#Here is code to largest and smallest digit of a number and the other steps required.
 def Digits ( n ) :
	largest = 0
	smallest = 9
	while ( n ) :
		r = n % 10
		largest = max ( r , largest )
		smallest = min ( r , smallest )
		n = n // 10
	print ( largest , smallest )
n = 2346
Digits ( n )