0
Why this code output is []
lst=list(range(0,10)) Print(lst[-1:2])
2 Respuestas
+ 4
lst[-1:2] is the same as lst[-1:2:1]. Go from the last element back to the third element in steps of +1. That's not possible, so the result is an empty list. If you change it to lst[-1:2:-1]), the result will be [9, 8, 7, 6, 5, 4, 3]
0
Thankyou!!