what does [::-1] mean in python

list[::]
So, when you do MyList[::-1], its starts from the end towards the begining taking each element by a step of 1 (hence -1). So, its reversing the list. Applicable to tuples as well

Here is what the above code is Doing:
1. It’s creating a list of numbers from 1 to 10.
2. It’s creating a list of numbers from 10 to 1.
3. It’s creating a list of numbers from 1 to 10 in reverse order.
4. It’s creating a list of numbers from 10 to 1 in reverse order.
5. It’s creating a list of numbers from 1 to 10 in reverse order.
6. It’s creating a list of numbers from 10 to 1 in reverse order.
7. It’s creating a list of numbers from 1 to 10 in reverse order.
8. It’s creating a list of numbers from 10 to 1 in reverse order.
9. It’s creating a list of numbers from 1 to 10 in reverse order.
10. It’s creating a list of numbers from 10 to 1 in reverse order.
11. It’s creating a list of numbers from 1 to 10 in reverse order.
12. It’s creating a list of numbers from 10 to 1 in reverse order.
13. It’s creating a list of numbers from 1 to 10 in reverse order.
14. It’s creating a list of numbers from 10 to 1 in reverse order.
15. It’s creating a list of numbers from 1 to 10 in reverse order.
16. It’s creating a list of numbers from 10 to 1 in reverse order.
17. It’s creating a list of numbers from 1 to 10 in reverse order.
18. It’s creating a list of numbers from 10 to 1 in reverse order.
19. It’s creating a list of numbers from 1 to 10 in reverse order.
20. It’s creating a list of numbers from 10 to 1 in reverse order.
21. It’s creating a list of numbers from 1 to 10 in reverse order.
22. It’s creating a list of numbers from 10 to 1 in reverse order.
23. It’s creating a list of numbers from 1 to 10 in reverse order.
24. It’s creating a list of numbers from 10 to 1 in reverse order.
25. It’s creating a list of numbers from 1 to 10 in reverse order.
26. It’s creating a list of numbers from 10 to 1 in reverse order.
27. It’s creating a list of numbers from 1 to 10 in reverse order.
28. It’s creating a list of numbers from 10 to 1 in reverse order.
29. It’s creating a list of numbers from 1 to 10 in reverse order.
30. It’s creating a list of numbers from 10 to 1 in reverse order.
31. It’s creating a list of numbers from 1 to 10 in reverse order.
32. It’s creating a list of numbers from 10 to 1 in reverse order.
33. It’s creating a list of numbers from 1 to 10 in reverse order.
34. It’s creating a list of numbers from 10 to 1 in reverse order.
35. It’s creating a list of numbers from 1 to 10 in reverse order.
36. It’s creating a list of numbers from 10 to 1 in reverse order.
37. It’s creating a list of numbers from 1 to 10 in reverse order.
38. It’s creating a list of numbers from 10 to 1 in reverse order.
39. It’s creating a list of numbers from 1 to 10 in reverse order.
40. It’s creating a list of numbers from 10 to 1 in reverse order.
41. It’s creating a list of numbers from 1 to 10 in reverse order.
42. It’s creating a list of numbers from 10 to 1 in reverse order.
43. It’s creating a list of numbers from 1 to 10 in reverse order.
44. It’s creating a list of numbers from 10 to 1 in reverse order.
45. It’s creating a list of numbers from 1 to 10 in reverse order.
46. It’s creating a list of numbers from 10 to 1 in reverse order.
47. It’s creating a list of numbers from 1 to 10 in reverse order.
48. It’s creating a list of numbers from 10 to 1 in reverse order.
49. It’s creating a list of numbers from 1 to 10 in reverse order.
50. It’s creating a list of numbers from 10 to 1 in reverse order.
51. It’s creating a list of numbers from 1 to 10 in reverse order.
52. It’s creating a list of numbers from 10 to 1 in reverse order.
53. It’s creating a list of numbers from 1 to 10 in reverse order.
54. It’s creating a list of numbers from 10 to 1 in reverse order.
55. It’s creating a list of numbers from 1 to 10 in reverse order.
56. It’s creating a list of numbers from 10 to 1 in reverse order.