0

could u pls explain the steps with result....???

sqs = [0, 1, 4, 9, 16, 25, 36, 49, 64, 81] print(sqs[7:5:-1])

23rd Oct 2017, 6:19 PM
KiruthikaMuruganantham
KiruthikaMuruganantham - avatar
1 Respuesta
+ 1
starting index is 7 , ending index is 5, and step size is -1. so it will go from 7 to 5, but not reach to 5 because Python syntax does not account the last index, so it will be 7th index (49), then 6th index (36), and that's all the output- [49,36]
23rd Oct 2017, 6:56 PM
Adiel
Adiel - avatar