python 小案例demo05

#7、随机数配合二维数组 做出一个 Offices里面随机出人名来
import random
offices = [[],[],[]]
names = ["A","B","C","D","E","F","G"]
for name in names:
index = random.randint(0,2)
offices[index].append(name)
i = 1
for office in offices:
print("办公室%d 人数为%d"%(i,len(office)))
i += 1
for name in office:
print("%s"%name,end="\t")
print("\n")
print("-"*30)

本文作者:AxeBurner

本文链接:https://www.cnblogs.com/bichen-01/p/13890339.html

版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。

posted @   AxeBurner  阅读(72)  评论(0编辑  收藏  举报
点击右上角即可分享
微信分享提示
💬
评论
📌
收藏
💗
关注
👍
推荐
🚀
回顶
收起
  1. 1 404 not found REOL
404 not found - REOL
00:00 / 00:00
An audio error has occurred.