+ 2
28th Jan 2021, 2:43 AM
Imad Ezzahi
Imad Ezzahi - avatar
4 Answers
+ 7
print([v for i, v in enumerate(list) if not i % 2])
28th Jan 2021, 2:48 AM
visph
visph - avatar
+ 6
But don't use 'list' as a variable name, you end up redefining the type. for instance; list() function will no longer work
28th Jan 2021, 2:55 AM
ChaoticDawg
ChaoticDawg - avatar
28th Jan 2021, 4:12 AM
jtrh
jtrh - avatar
+ 1
Sorry I mean list1
28th Jan 2021, 2:57 AM
Imad Ezzahi
Imad Ezzahi - avatar