human
Maximize the value of the given expression | Function to return the maximum result.
To store the count of negative integers.
Sum of all the three integers.
Product of all the three integers.
To store the smallest and the largest among all the three integers.
Calculate the count of negative integers.
When all three are positive integers.
For single negative integer.
For two negative integers.
For three negative integers.
Driver Code"
How can the above be solved in Python?
assistant
#Here is code to maximize the value of the given expression and the other steps required.
 def maximumResult ( a , b , c ) :
	countOfNegative = 0
	Sum = a + b + c
	product = a * b * c
	largest = max ( a , b , c )
	smallest = min ( a , b , c )
	if a < 0 :
		countOfNegative += 1
	if b < 0 :
		countOfNegative += 1
	if c < 0 :
		countOfNegative += 1
	if countOfNegative == 0 :
		return ( Sum - largest ) * largest
	elif countOfNegative == 1 :
		return ( product // smallest ) + smallest
	elif countOfNegative == 2 :
		return ( product // largest ) + largest
	elif countOfNegative == 3 :
		return ( Sum - smallest ) * smallest
if __name__ == " _ _ main _ _ " :
	a , b , c = - 2 , - 1 , - 4
	print ( maximumResult ( a , b , c ) )