print ("This program is to make: \n")
print ("It a red LED turn ON for the wrong guessing\n")
print("It a blue LED turn ON for the correct guessing\n")
print("Remarks: No limit on guessing trials\n")
from utime import sleep
from machine import Pin
#utime since upython is used
led_red = Pin(14, Pin.OUT) #Connect the LED to GPIO 14
led_blue = Pin(12, Pin.OUT) #Connect the LED to GPIO 12
target = 14
while True:
#forever loop
print('& obtain input from the user:')
value = int(input ("Enter an integer between 1 and 100: "))
if value > target:
print ("WRONG!", value, "is high/too high")
for i in range(3):
led_red.on()
sleep(1)
led_red.off()
sleep(1)
led_blue.off()
elif int (value) < target:
print ("WRONG!", value, "is low/too low")
led_red.on()
led_blue.off()
else:
print ("Perfect! Kudos!")
led_blue.on()
led_red.off()
break