Summarize the content notation of python. For myself for learning.
Nested inclusion notation.
This comprehension is nested.
If it is nested, in this figure, it is executed from for i in range (4) and the process [row [i] for row in matrix] is performed.
Also, the zip () function allows you to process multiple values at once.
Dictionary type comprehension
The dictionary-type comprehension covers the whole with curly braces.
The description of only the if statement is described afterwards.
When describing both if and else, describe with a prefix.
Since it is a dictionary type, write a judgment formula for both key and value.
There is also a way to write using zip as described later.
You can also describe the contents of the set by writing without a colon.
Recommended Posts