学生志愿分配的代码,为什么只能分配到第一志愿,其他志愿分配不到?
程序代码:
import openpyxl import statistics as stats book = openpyxl.load_workbook('志愿.xlsx') zy = book["小学"] jh = book["计划信息"] hangshu = 1 break_1= 0 for hang1 in range(2,730): for lie in range(3,8): x = zy.cell(hang1,lie).value for hang2 in range(2,7): y = jh.cell(hang2,2).value jhs = jh.cell(hang2,4).value #计划数 sjs = jh.cell(hang2,6).value #实际数 if y == x: if int(jhs) > int(sjs): jh.cell(hang2,6).value = sjs+1 zy.cell(hang1,9).value = x break_1= 1 print(lie,x,y) if break_1 == 1: break print(hang1) book.save('志愿.xlsx')