Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

List Comprehension simple example

# for understanding, above generation is same as,
odd_square = []
 
for x in range(1, 11):
    if x % 2 == 1:
        odd_square.append(x**2)
 
print (odd_square)
Source by softhunt.net #
 
PREVIOUS NEXT
Tagged: #List #Comprehension #simple
ADD COMMENT
Topic
Name
2+2 =