Answers for "Creating a list with list comprehensions"

0

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)
Posted by: Guest on October-27-2021

Code answers related to "Creating a list with list comprehensions"

Browse Popular Code Answers by Language