import random
print('开始请按6')
print('按任意数字键退出')
names = ['A', 'B', 'C','D' ,'E','F','G','H']
while True:
num = int(input(''))
if num == 6:
# 定义老师办公室
offices = [[], [], []]
# 老师人数 8人
# names = ['A', 'B', 'C','D' ,'E','F','G','H']
#找到每一个办公室
# office = random.randint(0,2)
# 把8位老师随机分配到对应的办公室里
for name in names:
index = random.randint(0, 2)
# 把老师随机添加到办公室
offices[index].append(name)
if (len(offices[0]) == 0) or (len(offices[1]) == 0) or (len(offices[2]) == 0):
del offices
else:
#保证每个办公室至少有一位老师
# if (len(offices[0])>=1)and(len(offices[1]))and(len(offices[2])):
i = 1
# 打印所有的办公室里有哪些老师
for office in offices:
print('办公室%d的人数为:%d' % (i, len(office)))
i += 1
# 打印每个办公室有哪些人
for name in office:
print(name, end='')
break
else:
break