0
What is list and dictionary comprehension and why are they used
2 Respostas
+ 1
I got it.👍
0
They are used to simplify the creation of a container with content.
Regular way:
letters = []
for n in range(10):
letters.append(chr(n))
Comprehensive way:
letters = [chr(n) for n in range(10)]