Articles → Python → List Comprehension In Python
List Comprehension In Python
Purpose
Example
out = []
for x in range(1, 5):
out.append(x)
print(out)
out = []
out = [x for x in range(1,5)]
print (out)
Output
Posted By - | Karan Gupta |
|
Posted On - | Monday, March 11, 2019 |