Comprehension
1. They are easy to write, concise and powerful way of data transformation.
2. They are one of the most powerful and useful feature of python.
Example as below
Square = [i**2 for i in range(50) if i % 3 == 0)
The same would need more lines of code if we use traditional for loop.
-- Notes from classes of Michele Vallisneri
1. They are easy to write, concise and powerful way of data transformation.
2. They are one of the most powerful and useful feature of python.
Example as below
Square = [i**2 for i in range(50) if i % 3 == 0)
The same would need more lines of code if we use traditional for loop.
-- Notes from classes of Michele Vallisneri