+ 1

What does [1:] and [0:1] mean?

https://code.sololearn.com/ccJ13qgHF9P8/?ref=app x="" for i in input().split(): x += i[1:] + i[0:1] + "ay " print (x)

15th Jan 2021, 5:55 PM
Ash 07
Ash 07 - avatar
2 ответов
+ 5
https://www.w3schools.com/JUMP_LINK__&&__python__&&__JUMP_LINK/python_lists_access.asp Someone else can explain better than me. But what I remember, [1:] returns everything from index 1 and beyond And [0:1] Returns anything from the starting index up but not including the ending index. Since you have [0:1], the program will only return index 0.
15th Jan 2021, 5:57 PM
Raul Sanchez
Raul Sanchez - avatar
+ 1
Thanks
15th Jan 2021, 6:00 PM
Ash 07
Ash 07 - avatar