根据CSDN的搜索,借鉴,写了一个随机座位表。但是,在运行的时候,输入了人数和每行人数之后,无法获得的座位表。
这个是我的编码
import random
def app(a, b):
def printStudentId():
def printlistId():
StudentId = range(1, a + 1)
listId = random.sample(StudentId, a)
for i in range(0, len(listId), b):
print(listId[i:i+b])
printStudentId()
a = input("输入总人数\n")
b = input("输入每行人数\n")
这个是运行结果