*如果有人能以任何方式帮助我,我将不胜感激!我星期五有考试,这将是一个很好的练习!目前未通过我的课程._。 :-( *
如何确定哪些储物柜将打开?
这是我的代码:
def locker_puzzle(lst):
num_lockers = 10
num_students = 10
num = 1
locker_list = [1,2,3,4,5,6,7,8,9,10]
locker_list = [False or True] * 10
open_lock = True
close_lock = False
while num**2 < num_lockers:
for i in range(len(locker_list)):
locker_list.append(num**2)
num += 1
if num % i <= num_lockers:
num_lockers = open_lock
return locker_list
if num % i >= num_lockers:
num_lockers = close_lock
def main():
l= [1,2,3,4,5,6,7,8,9,10]
print(locker_puzzle(l))
main()