标签:print 学习 随机 auth 工位 pytho coding %s mes
__author__ = ‘zht‘
#!/usr/bin/env python
# -*- coding: utf-8 -*-
‘‘‘
#努力学习每一天
‘‘‘
import random
offices = [[],[],[]]
names = [‘A‘,‘B‘,‘C‘,‘D‘,‘E‘,‘F‘,‘G‘,‘H‘]
i = 1
for name in names:
index = random.randint(0,2)
offices[index].append(name)
print(offices)
for temp in offices:
print("办公室%d的人数为%d"%(i,len(temp)))
for name in temp:
print("%s"%(name),end=‘,‘)
i+= 1
print("\n")
#某个学校,有3个办公室,现在有8位老师等待工位的分配,请编写程序,完成随机的分配
标签:print 学习 随机 auth 工位 pytho coding %s mes
原文地址:https://www.cnblogs.com/zhaohongtaodepython/p/9351129.html