Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Creating a list with list comprehensions

# construct a basic list using range() and list comprehensions
# syntax
# [ expression for item in list ]
digits = [x for x in range(10)]

print(digits)
Source by www.pythonforbeginners.com #
 
PREVIOUS NEXT
Tagged: #Creating #list #list #comprehensions
ADD COMMENT
Topic
Name
5+5 =