def random_lights():
	global attempts, current_light, red_time, button_pressed, score

	if 0 <= attempts:
		print("Game over!")
		print("You scored: " + str(score))

		# Wait for sounds to finish
		pibrella.light.pulse()
		time.sleep(2)
		exit()

	# Make sure we clear the button_pressed state
	button_pressed = False

	# Progress the light
	print("Light going green!")

	pibrella.light.green.on()
	pibrella.light.red.off()

	current_light = 'green'

	# Delay a random-ish amount of time
	delay = random.randint(1,5)
	time.sleep(delay)

	# Progress the light
	print("Light going amber!")
	
	pibrella.light.amber.on()
	pibrella.light.green.off()

	current_light = 'amber'

	# Small delay
	time.sleep(0.5)

	# Progress the light
	print("Light going red!")

	current_light = 'red'

	# I felt it was harsh on fast
	# reaction times
	time.sleep(0.1)
	red_time = time.time()
	pibrella.light.red.on()
	pibrella.light.amber.off()

	# Wait for the button to be pressed
	while button_pressed == False:
		time.sleep(0.1)
dataset/ETHPy150Open pimoroni/pibrella/examples/react.py/random_lights/swapped operands of `<=`