Why its output is an empty list.i expect 6 as output but it not come | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why its output is an empty list.i expect 6 as output but it not come

https://code.sololearn.com/c4e6ejOiXpQ9/?ref=app

19th Apr 2020, 11:46 AM
Ashish goyal
Ashish goyal - avatar
4 Answers
+ 2
It is printing element with index -1 which is nothing
19th Apr 2020, 12:30 PM
Raj Kalash Tiwari
Raj Kalash Tiwari - avatar
0
Interesting situation. You are reading from -1 rightwards until you get to index 3. Problem: -1 is already beyond 3, so your slice is over before it even started.
19th Apr 2020, 12:48 PM
HonFu
HonFu - avatar
0
Can you explain more simply ?I didn't understand.
19th Apr 2020, 2:56 PM
Ashish goyal
Ashish goyal - avatar