# ------------------------------task1------------------------------
half_basketball = total_students / 2
# -------------------------------task2-----------------------------
ratio_math_basketball_soccer = [4, 3, 2]
# Calculate the total ratio units
total_ratio_units = sum(ratio_math_basketball_soccer)
# Calculate the number of students per ratio unit
students_per_unit = basketball_team / ratio_math_basketball_soccer[1]
# Calculate the number of students on each team
math_team = students_per_unit * ratio_math_basketball_soccer[0]
soccer_team = students_per_unit * ratio_math_basketball_soccer[2]
(math_team, basketball_team, soccer_team)
# ------------------------------task3-------------------------------
# Given values from previous tasks
# Total number of students
# Calculate the number of students playing in exactly two teams using the inclusion-exclusion principle
students_two_teams = (math_team + basketball_team + soccer_team) - total_students - (2 * students_all_three)