peoples=["A","B","C","D","E","F","G","G"]
#三个空的房间
homes=[[],[],[]]
import random
for people in peoples:
x = random.randint(0, 2)
homes[x].append(people)
i =1
for home in homes:
print("此房间%d有%d人"%(i,len(home)))
i+=1
for people in home:
print("%s"%people,end="\t")
print("\n")
print("-"*30)
此房间1有5人
A C D E G------------------------------
此房间2有2人
B G------------------------------
此房间3有1人
F------------------------------