List comprehension can generate lists with one line of code
code:
squares = [value**2 for value in range(1,11)]
print(squares)
output result
List comprehension can generate lists with one line of code
code:
squares = [value**2 for value in range(1,11)]
print(squares)
output result