from machine import Pin
import time
led_pins = [2, 4, 15, 5]
key_pins = [35, 32, 33, 25]
leds = [Pin(pin, Pin.OUT) for pin in led_pins]
keys = [Pin(pin, Pin.IN, Pin.PULL_UP) for pin in key_pins]
states = [0] * len(led_pins)
while True:
for i, key in enumerate(keys):
if not key.value():
time.sleep_ms(9)
if not key.value():
states[i] = not states[i]
leds[i].value(states[i])
while not key.value():
pass