# Umar Bashir
import machine
import time
# Pin numbers for the LEDs
GREEN_LED_PIN = 0
YELLOW_LED_PIN = 2
RED_LED_PIN = 3
# Set the LED pins as OUTPUT
green_led = machine.Pin(GREEN_LED_PIN, machine.Pin.OUT)
yellow_led = machine.Pin(YELLOW_LED_PIN, machine.Pin.OUT)
red_led = machine.Pin(RED_LED_PIN, machine.Pin.OUT)
cold = 0
warm = 0
hot = 0
for temperature in range(0, 101):
if temperature >= 0 and temperature <= 10:
print("Cold")
green_led.on() # Turn on Green LED
yellow_led.off() # Turn off Yellow LED
red_led.off() # Turn off Red LED
cold += 1
elif temperature >= 11 and temperature <= 35:
print("Warm")
green_led.off() # Turn off Green LED
yellow_led.on() # Turn on Yellow LED
red_led.off() # Turn off Red LED
warm += 1
else:
print("Hot")
green_led.off() # Turn off Green LED
yellow_led.off() # Turn off Yellow LED
red_led.on() # Turn on Red LED
hot += 1
time.sleep(0.5) # Delay for half a second for better visualization
print("Total hot days: ", hot)
print("Total warm days: ", warm)
print("Total cold days: ", cold)
# Score
#Circuit design - 95
#Code - 95
#Working – 90
#Score – 93