Cycle a Traffic Light

Write the code, see it run, pass the checks.

The problem

  • easy
  • Code

Step through a UK traffic light's sequence. Show a line reading "Light: Red" and a "Next" button. Each click moves on to the next light, in the order Red, Red and amber, Green, Amber, and then back to Red, round and round.

Your code must pass

  • It starts on "Light: Red"
  • Next steps through the sequence in order
  • After Amber it goes back to Red