Python's negative indexing lets you access elements from the end of a list without needing to know its length. For example, marks = [25, 35, 36, 45, 55] and print(marks[-1]) outputs 55. The index -1 always refers to the last item, -2 to the second last, and so on. This quick tip saves time and makes code more readable—especially when dealing with dynamic lists.
Related Stories
AI
Nvidia’s Huang Fuels U.S. Economy’s AI Addiction as Stocks Surge
Dec 3, 2026
AI
Anthropic Pauses AI Development Over Cybersecurity Fears
Dec 3, 2026
AI
Cloud Wars 2026: The 10 Cheapest AWS Alternatives to Slash Your Bill
Dec 3, 2026
AI
Generative AI Recommenders Take Over: How Single Models Are Replacing Decades of Tech Stacks
Dec 3, 2026