+ 1
Wouldn't it be [49, 36, 25, 16]?
Does the list not start from the 8th spot from the right (because 0 is included, 1+7=8) 49, and end at the 5th spot from the right, 16?
3 odpowiedzi
+ 7
No, it starts at index position 7 (from the left), i.e. 49 then moves to the left and ends just before index position 5 (also from the left), i.e. the last number is index position 6, which is 36, so the output is [49, 36].
+ 1
?!
+ 1
Sorry, the question was "what is the output of this code?"
sqs = [0, 1, 4, 9, 16, 25, 36, 49, 64, 81]
print(sqs[7:5:-1])