You are viewing a single comment's thread. Return to all comments →
The ":" allows Python select (Slice) all the elements before the nth element.
s = (abacde)
s[:3] = (aba)
So if n is 3, this allows Python to select all elements up to, but not including the 3rd item.
Seems like cookies are disabled on this browser, please enable them to open this website
Repeated String
You are viewing a single comment's thread. Return to all comments →
The ":" allows Python select (Slice) all the elements before the nth element.
s = (abacde)
s[:3] = (aba)
So if n is 3, this allows Python to select all elements up to, but not including the 3rd item.