from machine import Pin
from time import sleep

E = Pin(4,Pin.OUT, value=1)
D = Pin(2,Pin.OUT, value=1)
C = Pin(15,Pin.OUT, value=1)
G = Pin(5,Pin.OUT, value=1)
F = Pin(18, Pin.OUT, value=1)
A = Pin(19, Pin.OUT, value=1)
B = Pin(21, Pin.OUT, value=1)

DIGITS = {
  "0": [A, B, C, D, E, F],
  "1": [B,C],
  "2": [A,B,G,E,D],
  "3": [A,B,G,C,D],
  "4": [F,B,G,C],
  "5": [A,F,G,C,D],
  "6": [A,F,G,C,D,E],
  "7": [F, A, B, C],
  "8": [A,B,C,D,E,F,G],
  "9": [A,B,C,D, F,G]
}


while True:
  input_digit=input("Input your digit: ")
  data = DIGITS[input_digit]
  for led in DIGITS["8"]:
    led.on()
  for led in data:
    led.off()