Python 3.x 还记得上次展示作业的3个学生吗
上次展示作业的3名学生。每次运行此程序时,它都会挑选一组新的3名学生。假设给出了学生的卷号Python 3.x 还记得上次展示作业的3个学生吗,python-3.x,Python 3.x,上次展示作业的3名学生。每次运行此程序时,它都会挑选一组新的3名学生。假设给出了学生的卷号 students_roll_number = [1,2,3,4,5,6,7,8,9,10,11] students_homework_showed = [3,4,5] 让那些还没拿出作业的学生 students_homework_pending = [students_roll_number[i] for i in range(len(students_roll_number)) if studen
students_roll_number = [1,2,3,4,5,6,7,8,9,10,11]
students_homework_showed = [3,4,5]
让那些还没拿出作业的学生
students_homework_pending = [students_roll_number[i] for i in range(len(students_roll_number)) if students_roll_number[i] not in students_homework_showed]
输出为
students_homework_pending = [1, 2, 6, 7, 8, 9, 10, 11]
现在我们从候补名单中选出3名学生
students_to_check = []
for i in range(3):
students_homework_showed.append(students_homework_pending[i])
students_to_check.append(students_homework_pending[i])
可供选择的新生
print("chosen student is : ", students_to_check)
你能提供一些详细的问题吗