Python double/nested for loop list comprehension
Single for-loop with if condition
=
In List comprehension
>>> =
>>>
Single for-loop with if-else conditions
=
In List comprehension
>>> =
>>>
Double for-loops with if condition
=
In List comprehension
>>> =
>>>
See how the outer for loop came first then the inner for loop
Double for-loops with if and else conditions
=
In List comprehension
>>> =
>>>
Disclaimer: Writing double for loops with if-else conditions severely affects the readability of the code. Please use it at your own risk.