+ 1

what is the default value of start and end argument if step is negative in slice notation ?

lst=[1,2,3,4,5] print(lst[::-1] #[start : end : step] #output : [5,4,3,2,1] here, step is -1 right ? then what is the default of start and end ?

13th Nov 2020, 4:59 PM
Ratnapal Shende
Ratnapal Shende - avatar
3 Antworten
+ 1
👿BAD BOY! you mean lst[::-1] is same as lst[1:5:-1] ? if yes then output is empty sir [ ]
13th Nov 2020, 5:13 PM
Ratnapal Shende
Ratnapal Shende - avatar