Switches = [0, 1, 0, 1, 0, 0, 0, 1]
Orders = [('남', 3)]
num = Orders[0][1]
if Orders[0][0] == '남':
for i in range(len(Switches)):
if (i + 1) % num == 0:
Switches[i] = 1 - Switches[i]
else:
center = num - 1
Switches[center] = 1 - Switches[center]
left = center - 1
right = center + 1
while left >= 0 and right < len(Switches):
if Switches[left] == Switches[right]:
Switches[left] = 1 - Switches[left]
Switches[right] = 1 - Switches[right]
left -= 1
right += 1
print(Switches)
To embed this project on your website, copy the following code and paste it into your website's HTML: