Skip to main content
Join the official 2020 Python Developers SurveyStart the survey!

A Traffic Light Simulator

Project description

Traffic Light Simulator Goals

This is an attempt to simulate a simple traffic light. You can specify how long you want each light show before it changes to the next light, as well as the number of cycles (green to red or red to green light changes) you want before the simulator stops running.


Install with pip

You may want to do this in a virtualenv if you don’t want to clutter up your global packages. Certainly not necessary, but if you want to use a virtualenv just:

$ virtuanelv testenv
$ cd testenv
$ . bin/activate

Then simply install with pip:

$ pip install traffic-light-simulator

Using the source files

Simply clone this repo.

Running the simulator

If you installed with pip, you have a script available to you to run the simulator. Simply enter into your terminal:

$ traffic-light-simulator

Otherwise, if you’ve cloned the repo, just run the traffic_light_simulator/ with your interpreter:

$ python

Running the tests

There are some tests that I wrote while writing the TrafficLight class, located in If you want to run it simply run it with your interpreter

$ python

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for traffic-light-simulator, version 0.1.2
Filename, size File type Python version Upload date Hashes
Filename, size traffic-light-simulator-0.1.2.tar.gz (3.8 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page