In one of my previous articles, I briefly discussed the concept of Generator Expressions, in this one we are going to explore Generators in detail.
Before moving ahead, make sure you are familiar with some basic terms,
While writing an article about Generators, I realized that though iteration, iterable and iterator are so commonly used in programming; there is a certain degree of confusion around them. It’s crucial to understand the underlying concept for a better implementation. This is going to be a short and quick article to help us determine what is an iterable and what is an iterator.
To understand Python’s Comprehension capabilities, it’s important to understand the concept of comprehension at first. Comprehension in programming is nothing but writing the (existing) code in a short and concise manner, mostly one single line. It is constructing a new sequence by shortening the existing one. Being good at code comprehension is fairly an important skill. You need to understand the implementation to apply the comprehension capabilities of programming. Python-3 supports comprehensions for,
String interpolation is a process of injecting value into a placeholder (a placeholder is nothing but a variable to which you can assign data/value later) in a string literal. It helps in dynamically formatting the output in a fancier way. Python supports multiple ways to format string literals. All string interpolation methods always return new values and do not manipulate the original string.