Reiter
We can reduce our for-lop structure down to a single line "list comprehension" in python.
In many cases, this can make the code more readable, but one has to be careful not to overdo it and create an extremely complex comprehension instead of three lines of "good code" just to get it done in one line.
A good rule of thumb might be to ask if the line can be explained in a short sentence. If so, the comprehension is likely well-made, but if the sentence starts to feel like rambling, maybe split the line up into segments.
In many cases, this can make the code more readable, but one has to be careful not to overdo it and create an extremely complex comprehension instead of three lines of "good code" just to get it done in one line.
A good rule of thumb might be to ask if the line can be explained in a short sentence. If so, the comprehension is likely well-made, but if the sentence starts to feel like rambling, maybe split the line up into segments.