def traffic_light(limit):
  time = 0
  lights = {"NS": "ggggggggyyyrr", "WE": "rrrrrrrrrrrrr"}
  i = 0
  while time <= limit:
    print str(time) + ' NS: ' + lights['NS'][i] + ', WE: ' + lights['WE'][i] 
    time += 1
    i += 1
    if i == 13:
      i = 0
      lights['NS'], lights['WE'] = lights['WE'], lights['NS']    


traffic_light(30)

results matching ""

    No results matching ""