0

Can somebody explain this code to me print('abcd' [-3,-1]). Thank youuu

18th May 2020, 6:48 PM
Ryan Christopher Valleja Edquila
Ryan Christopher Valleja Edquila - avatar
3 ответов
+ 6
print('abcd' [-3:-1]) Last element is at index -1. So at index -3 you have 'b'. You need to move from index -3 to -1 (excluded). Hence it prints 'bc'.
18th May 2020, 6:57 PM
Avinesh
Avinesh - avatar
+ 5
hi, can you confirn it is 'abcd' [-3:-1] ?
18th May 2020, 6:57 PM
Oma Falk
Oma Falk - avatar
0
Thank you
18th May 2020, 7:33 PM
Ryan Christopher Valleja Edquila
Ryan Christopher Valleja Edquila - avatar