+ 2

Find the error

S="PURA VIDA" print(S[9]+S[9:15])

23rd Nov 2019, 9:39 AM
Harshita...Xx
Harshita...Xx - avatar
3 Answers
+ 7
Harshita...Xx Index out of range. You have only 9 elements from index 0 to 8. Then how can you print index 9 or 9:15.
23rd Nov 2019, 9:49 AM
Avinesh
Avinesh - avatar
+ 5
I want to add that it's the first part giving you the error (index too large). The slice operation (9:15) just gives you an empty string.
23rd Nov 2019, 11:10 AM
HonFu
HonFu - avatar
0
Hi
6th Nov 2020, 6:31 AM
Dinesh Kumar
Dinesh Kumar - avatar