You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use a colon inside the index brackets to get a "slice" of the list, returned as a list.
element_slice = elements[1:5] # from index 0 up to (not including) index 5
print(element_slice) # Prints ['He', 'Li', 'B', 'C']
-------------corrected below ----------------
from index 1 up to (not including) index 5
Index starts from 1 not 0 for this example of slice
The text was updated successfully, but these errors were encountered:
Use a colon inside the index brackets to get a "slice" of the list, returned as a list.
element_slice = elements[1:5] # from index 0 up to (not including) index 5
print(element_slice) # Prints ['He', 'Li', 'B', 'C']
-------------corrected below ----------------
from index 1 up to (not including) index 5
Index starts from 1 not 0 for this example of slice
The text was updated successfully, but these errors were encountered: