import random
classroom = [[],[],[]]
teachers = ["A","B","C","D","E","F","G","H"]
for teacher in teachers:
classroom[random.randint(0,2)].append(teacher)
for i in range(3):
print("第%d个教室有%d个人"%(i+1,len(classroom[i])))
for j in range(len(classroom[i])):
print(classroom[i][j],end="\t")
print("\n")
print("*"*20)
结果