Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1
Because you started with -1 (81) that mean from the last num and you ended with 1 if you count from the last 1 means the last number (81) you started the number where you end that's why it's empty list You should use print(squares[1:-1]) You will get from 1 to 64 Or if you want different result please let me know.
23rd Sep 2020, 12:03 PM
Tarun Gautam
Tarun Gautam - avatar
0
In case you want to get values from last index(-1) to 1 ,then you will have to add negative step squares[-1:1-1]
23rd Sep 2020, 12:09 PM
Abhay
Abhay - avatar