我们需要创建一个程序,为项目设置第一轮锦标赛。如果参赛者人数不均,则要求节目添加轮空。这是我的代码:
from random import*
bye=[]
teams=[]
while True:
team=str(input("Enter the team names.(-1 to exit):\n"))
teams.append(team)
if team=="-1": break
if (len(teams))%2!=0:
teams.append("bye")
print(" Tournament ")
print("------------------------------")
shuffle(teams)
for i in range(len(teams)):
print(team[i], team[i+1])
错误?