human
Minimum number of steps required to obtain the given Array by the given operations | Function to calculate the minimum steps to obtain the desired array.
Initialize variable.
Iterate over the array arr [ ].
Check if i > 0.
Update the answer.
Return the result.
Driver Code"
How can the above be solved in Python?

What is a code to minimum number of steps required to obtain the given Array by the given operations and the other steps required?
assistant
#Here is code to minimum number of steps required to obtain the given Array by the given operations and the other steps required.
 def min_operation ( a , n ) :
	ans = 0
	for i in range ( n ) :
		if ( i > 0 ) :
			ans += abs ( a [ i ] - a [ i - 1 ] )
		else :
			ans += abs ( a [ i ] )
	return ans
if __name__ == " _ _ main _ _ " :
	arr = [ 1 , 2 , 3 , 4 ]
	n = len ( arr )
	print ( min_operation ( arr , n ) )