Get Unlimited Contributor Access to the all ExamTopics Exams!
Take advantage of PDF Files for 1000+ Exams along with community discussions and pass IT Certification Exams Easily.
Negative step changes a way, slice notation works. It makes the slice be built from the tail of the list. So, it goes from the last element to the first element. So [-1:1:-1] will start from last element of the list and will end end at 2nd element of list, thus as 0th and 1st are sliced we will be left with 7 elements
YOu maybe understand better with this example:
>>> list1=[i for i in range(1,10)]
>>> list1
[1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> list2=list1[-1:1:-1]
>>> list2
[9, 8, 7, 6, 5, 4, 3]
upvoted 20 times
...
...
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
Avidulam
Highly Voted 3 years, 1 month agoshilpadk
Most Recent 4 months, 4 weeks agonaveenbv80
1 year, 4 months agomacxsz
1 year, 11 months agochr000
3 years, 8 months agokauser
3 years, 7 months agoEfren
3 years ago