Mega Code Archive

 
Categories / Python Tutorial / List
 

A step size of two will include only every other element of the interval between the start and the end

numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] print numbers[0:10:2]  print numbers[3:6:3]