First time here? Check out the FAQ!
answered 2017-09-17 21:16:13 +0100
using list comprehension:
sage: [i for i in [1..10] if i%2==0] [2, 4, 6, 8, 10]
see more alternatives in the Programming in Python and Sage Thematic Tutorial.