这个问题应该从哪个方向入手?

共有32只球队
欧洲:法国、西班牙、波兰、丹麦、荷兰、德国、威尔士、英格兰、比利时、塞尔维亚、克罗地 亚、瑞士、葡萄牙
亚洲:中国、伊朗、澳大利亚、沙特、日本、韩国
南美洲:巴西、厄瓜多尔、阿根廷、乌拉圭
中北美及加勒比:美国、哥斯达黎加、加拿大、墨西哥
非洲:加纳队、突尼斯队、摩洛哥队、塞内加尔队、喀麦隆队
其中第一档球队分别是:法国、西班牙、德国、英格兰、葡萄牙、巴西、阿根廷、荷兰
第二档球队是: 波兰、丹麦、比利时、中国、喀麦隆、乌拉圭、日本、克罗地亚
现在分组规则如下:
●共分8个组,分别:A组B组C组D组E组F组G组H组
●每组只能有一支第一档球队,只能有一只第二档球队;
●每组一共有四支球队。非第一档、非第二档球队随机进行某一组
●小组积分前两名出线,开始淘汰赛
●出线后对阵图如下:后面CD /EF/ GH类似对阵
【可以参考2022年卡塔尔世界杯规则:
https://www.5068.com/zhishi/a544080.htnl

img

请编写程序:完成年中国世界杯的赛事编排,要求如下:
1、显示各小组分组情况
2、显示总共有多少场比赛场次
3、设计方法:判断中国队会遇到巴西队吗?如果遇到是什么时候碰到[小组赛、1/8.
1/4、半决赛、决赛]?

import random

teams = ["France", "Spain", "Poland", "Denmark", "Netherlands", "Germany", "Wales", "England", "Belgium", "Serbia", "Croatia", "Switzerland", "Portugal", "China", "Iran", "Australia", "Saudi Arabia", "Japan", "South Korea", "Brazil", "Ecuador", "Argentina", "Uruguay", "USA", "Costa Rica", "Canada", "Mexico", "Ghana", "Tunisia", "Morocco", "Senegal", "Cameroon"]
first_tier = ["France", "Spain", "Germany", "England", "Portugal", "Brazil", "Argentina", "Netherlands"]
second_tier = ["Poland", "Denmark", "Belgium", "China", "Cameroon", "Uruguay", "Japan", "Croatia"]
groups = []

# assign teams to groups
for i in range(8):
  group = []
  group.append(first_tier[i])
  group.append(second_tier[i])
  for j in range(2):
    team = random.choice(teams)
    while team in first_tier or team in second_tier or team in group:
      team = random.choice(teams)
    group.append(team)
  groups.append(group)

# print groupings
print("Groupings:")
for i in range(8):
  print("Group " + chr(ord('A') + i) + ": " + ", ".join(groups[i]))

# generate match schedule
matches = []
for i in range(8):
  for j in range(3):
    for k in range(j+1, 4):
      matches.append((groups[i][j], groups[i][k]))

# print number of matches
print("\nTotal number of matches: " + str(len(matches)))

# function to check if China will play Brazil
def will_play_brazil(stage):
  if stage == "group":
    for i in range(8):
      if "China" in groups[i] and "Brazil" in groups[i]:
        return True
    return False
  elif stage == "knockout":
    if (len(matches) - len(groups) * 6) % 8 < 4:
      # China is in top half of knockout bracket
      if (matches[-1][0] == "China" and matches[-1][1] == "Brazil") or (matches[-1][1] == "China" and matches[-1][0] == "Brazil"):
        return True
      else:
        return False
    else:
      # China is in bottom half of knockout bracket
      if (matches[-5][0] == "China" and matches[-5][1] == "Brazil") or (matches[-5][1] == "China" and matches[-5][0] == "Brazil"):
        return True
      else:
        return False

# check if China will play Brazil
if will_play_brazil("group"):
  # print when China will play Brazil (if they do at all)
  print("\nChina will play Brazil in the group stage.")
elif will_play_brazil("knockout"):
  print("\nChina will play Brazil in the knockout stage.")
else:
  print("\nChina will not play Brazil in this World Cup.")