Everything you can use “for... in..." on is an iterable; lists, strings, files. Let’s learn more itertools with explanations and examples.

Image for post
Image for post

The iterator is defined as object types which contains values that can be accessed or iterated using a loop. There are different iterators that come built-in with Python such as lists, sets, etc. Itertools is the Python module that contains some inbuilt functions for generating sequences using iterators.

There are different types of Iterators:

  1. Infinite Iterators: These type of iterators produce infinite sequences.(count(), cycle(), repeat())
  2. Short sequence iterators (terminating): These iterators produces the sequences which terminate after certain iterations.(accumulate(), chain(), compress(), dropwhile(), filterfalse(), zip_longest() etc.) …


Image for post
Image for post

Python is an interpreted, object-oriented, high-level programming language with dynamic semantics. It’s high-level built-in data structures, combined with dynamic typing and dynamic binding, make it very attractive for Rapid Application Development, as well as for use as a scripting or glue language to connect existing components together.

Python is a very popular language. It’s also one of the languages that I recommend for beginners to start with. But how do you go about learning this language?

Sahil Hashimli

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store