DekGenius.com
Home
(current)
Dictionary
BOOKS
LYRICS
CHORD
SCRIPT & CODE EXAMPLE
Karaoke language
Search
Go
SCRIPT & CODE EXAMPLE
CODE EXAMPLE FOR PYTHON
python 1 line for loop with else
mylist = [1,4,5,8,9,11,13,12] newlist = [x+1 if x%2 == 1 else x for x in mylist] print(newlist)
Source by www.delftstack.com #
PREVIOUS
NEXT
Tagged:
#python
#line
#loop
ADD COMMENT
Topic
COMMENT
Name
3+4 =
Submit