python slice
a[start:stop] # items start through stop-1
a[start:] # items start through the rest of the array
a[:stop] # items from the beginning through stop-1
a[:] # a copy of the whole array
python slice
a[start:stop] # items start through stop-1
a[start:] # items start through the rest of the array
a[:stop] # items from the beginning through stop-1
a[:] # a copy of the whole array
python slice operator
string = 'string_text'
beginning = 0 # at what index the slice should start.
end = len(string) # at what index the slice should end.
step = 1 # how many characters the slice should go forward after each letter
new_string = string[beginning:end:step]
# some examples
a = 0
b = 3
c = 1
new_string = string[a:b:c] # will give you: str
# ____________________________________________
a = 2
b = len(string) - 2
c = 1
new_string = string[a:b:c] # will give you: ring_te
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us