How to create a list with calculation and range in Python

1 Answer

0 votes
lst = [x ** 2 for x in range(10)]

print(lst)
 
 
'''
run:
 
[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]
 
'''

 



answered Jul 18, 2019 by avibootz

Related questions

...