human
Count Negative Numbers in a Column | Python implementation of Naive method to count of negative numbers in M [ n ] [ m ].
Follow the path shown using arrows above.
no more negative numbers in this row.
Driver code"
How can the above be solved in Python?
 ... Can you provide a code to count Negative Numbers in a Column and the other steps required?
assistant
#Here is code to count Negative Numbers in a Column and the other steps required.
 def countNegative ( M , n , m ) :
	count = 0
	for i in range ( n ) :
		for j in range ( m ) :
			if M [ i ] [ j ] < 0 :
				count += 1
			else :
				break
	return count
M = [ [ - 3 , - 2 , - 1 , 1 ] , [ - 2 , 2 , 3 , 4 ] , [ 4 , 5 , 7 , 8 ] ]
print ( countNegative ( M , 3 , 4 ) )