奶茶酱

奶茶酱の妙妙屋


[Python]班级摇人小助手

<h2><a href="https://wwp.lanzoup.com/iTLYM0il2jkb">点我跳转下载(Version-1.0)</a></h2> <h5>Version-1.0 支持班级内随机排座位,定量摇人</h5> <p>↓写的是一坨答辩的源码</p> <pre><code class="language-Python">import random import time #random库的练手脚本和听说最近要换位置就写了,应该用不到多少次( def random_seat(): total = int(input("请输入班级总人数"))+1 column = int(input("请输入同桌数")) data = list(range(1,total)) times = 0 o_times =0 random.shuffle(data) while True: if times != len(data): if o_times != column: print(data[times],end=",") o_times += 1 times += 1 else: print() o_times = 0 else: print('\n输出结束,请根据各班每组行数作座位安排(如依照以上输出结果以学号排列依次从头至尾坐满)') time.sleep(3) break def random_student(): total = int(input("请输入班级总人数"))+1 numbers = int(input("请输入希望抽取学生个数")) data = list(range(1,total)) random.shuffle(data) for times in range(numbers): print(f'抽中了{data[times]}号同学\n') while True: a = int(input("※List of functions\n请输入序号进入对应功能索引\n1-班级随机排座位\n2-班级随机抽取序号\n0-退出脚本\n\n可能就写这点,什么时候放假回家什么时候更((")) if a == 0: break elif a == 1: random_seat() elif a == 2: random_student() else: print(f"未知指令/序号 异常报错:Index could not be performed;") </code></pre>

页面列表

ITEM_HTML