# libraries and function imports
import time
from machine import Pin
from random import randrange
time.sleep(0.1) # Wait for USB to become ready

ledr = Pin(0, Pin.OUT)
ledg = Pin(1, Pin.OUT)
ledgr = Pin(2, Pin.OUT)

while True:
    tal = randrange(0,30)
    ledg.off()
    ledgr.off()
    ledr.off()
    print (tal)
    if tal <10:
        ledr.on()
        time.sleep(2)
    elif tal >= 10 and tal <20:
        ledg.on()
        time.sleep(2)
    elif tal >= 20:
        ledgr.on()
        time.sleep(2)
    else:
        ledgr.on()
        ledg.on()
        ledr.on()

BOOTSELLED1239USBRaspberryPiPico©2020RP2-8020/21P64M15.00TTT