# Days 19-21: Itertools

Iteration is something you absolutely have to grasp in order to master Python.

Itertools helps make iteration simpler and is incredibly powerful which is why you'll be learning it for the next 3 days!


## Day N: Watch videos and Play in the Shell!

For your first day, watch all of the videos up until the traffic lights app.

After watching the first 4 videos pop into your Python shell and start playing around with `cycle()`, `product()`, `combinations()` and `permutations()`.


## Day N+1: Create a Traffic Lights script

Yep that's right! For your second day, use itertools to create a script that simulates traffic lights!

The idea is to perhaps... *cycle* (hint hint!) through the different colours of a set of traffic lights - red, amber and green - printing the name of the colour every time the cycle occurs.

For bonus points: traffic lights normally cycle between green and red based on traffic levels so you never know exactly when the change will happen. This is a great chance to throw some randomness into your script.

If you get absolutely stuck, watch the *Traffic Lights* video to see how we did it.


## Day N+2: Your Turn!

For your last day, I'm going to suggest you head to our [Pybites Platform](https://pybitesplatform.com) platform and take a few of the itertools themed Bites.

The following 3 links will get you free access to the Bites:

[Fix a truncating zip function](https://pybitesplatform.com/bites/fix-a-truncating-zip-function/)

[Form teams from a group of friends](https://pybitesplatform.com/bites/form-teams-from-a-group-of-friends/)

[Get all valid dictionary words for a draw of letters](https://pybitesplatform.com/bites/get-all-valid-dictionary-words-for-a-draw-of-letters/)

You don't need to do them in any particular order, they're just there for you to learn something!


### Time to share what you've accomplished!

Be sure to share your last couple of days work on Twitter or Facebook. Use the hashtag **#100DaysOfCode**.

Here are [some examples](https://twitter.com/search?q=%23100DaysOfCode) to inspire you. Consider including [@talkpython](https://twitter.com/talkpython) and [@pybites](https://twitter.com/pybites) in your tweets.

*See a mistake in these instructions? Please [submit a new issue](https://github.com/talkpython/100daysofcode-with-python-course/issues) or fix it and [submit a PR](https://github.com/talkpython/100daysofcode-with-python-course/pulls).*
