8.0 Omitting Indices


#1



https://www.codecademy.com/en/courses/python-beginner-en-KAgt5/2/2?curriculum_id=4f89dab3d788890003000096


Hi! i really want to understand this, i hope someone can explain the logic, would be great


to_five = ['A', 'B', 'C', 'D', 'E']
print to_five[:2]
# prints ['A', 'B']


#2

Hi! It just prints slice of your list from very beginning till item with index 2 (not included)


#3

its a list slice, starting at zero (default) increasing with steps of +1 (default) for values lesser then 2 (stop value):

prin to_five[0:2:1]

#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.