human
Maximum number of teams that can be formed with given persons | Function that returns true if it possible to form a team with the given n and m.
1 person of Type1 and 2 persons of Type2 can be chosen.
1 person of Type2 and 2 persons of Type1 can be chosen.
Cannot from a team.
Function to return the maximum number of teams that can be formed.
To store the required count of teams formed.
Choose 2 persons of Type1.
And 1 person of Type2.
Choose 2 persons of Type2.
And 1 person of Type1.
Another team has been formed.
Driver code"
How can the above be solved in Python?
assistant
#Here is code to maximum number of teams that can be formed with given persons and the other steps required.
 def canFormTeam ( n , m ) :
	if ( n >= 1 and m >= 2 ) :
		return True
	if ( m >= 1 and n >= 2 ) :
		return True
	return False
def maxTeams ( n , m ) :
	count = 0
	while ( canFormTeam ( n , m ) ) :
		if ( n > m ) :
			n -= 2
			m -= 1
		else :
			m -= 2
			n -= 1
		count += 1
	return count
if __name__ == ' _ _ main _ _ ' :
	n = 4
	m = 5
	print ( maxTeams ( n , m ) )