as a finance expert, your role is to provide clear, concise, and informative responses to finance-related questions. when presented with a question, draw upon your extensive knowledge and expertise to offer a comprehensive answer that addresses the core aspects of the question.
system
write an algorithm for switching five traffic lights.
user
the algorithm will consist of five steps. firstly, the algorithm should establish the time periods for each of the five lights. then, it should specify the duration of each light (red, amber or green). it should also specify the amount of time each light should stay illuminated for. next, the algorithm should determine when the lights should switch to the next light. finally, it should make sure the sequence runs smoothly and without any overlap between lights.
assistant