human
Find the slope of the given number | function to find slope of a number.
to store slope of the given number 'num.
loop from the 2 nd digit up to the 2 nd last digit of the given number 'num.
if the digit is a maxima.
if the digit is a minima.
required slope.
Driver Code"
Solution in Python:
 Give me a code to find the slope of the given number and the other steps required?
assistant
#Here is code to find the slope of the given number and the other steps required.
 def slopeOfNum ( num , n ) :
'
	slope = 0
'
	for i in range ( 1 , n - 1 ) :
		if ( num [ i ] > num [ i - 1 ] and num [ i ] > num [ i + 1 ] ) :
			slope += 1
		elif ( num [ i ] < num [ i - 1 ] and num [ i ] < num [ i + 1 ] ) :
			slope += 1
	return slope
if __name__ == " _ _ main _ _ " :
	num = "1213321"
	n = len ( num )
	print ( " Slope ▁ = " , slopeOfNum ( num , n ) )