DekGenius.com
Home
(current)
Dictionary
BOOKS
LYRICS
CHORD
SCRIPT & CODE EXAMPLE
Karaoke language
Search
Go
SCRIPT & CODE EXAMPLE
CODE EXAMPLE FOR PYTHON
python for loop one line
>>> x = [1, 2, 3, 4, 5] >>> y = [2*a for a in x if a % 2 == 1] >>> print(y) [2, 6, 10]
Source by stackoverflow.com #
PREVIOUS
NEXT
Tagged:
#python
#loop
#line
ADD COMMENT
Topic
COMMENT
Name
1+8 =
Submit