Suppose lst is 2, 33, 222, 14, 25, What is lst-1?

Technology CommunityCategory: PythonSuppose lst is 2, 33, 222, 14, 25, What is lst-1?
VietMX Staff asked 3 years ago
Problem

Suppose lst is [2, 33, 222, 14, 25], What is lst[-1]?

It’s 25. Negative numbers mean that you count from the right instead of the left. So, lst[-1] refers to the last element, lst[-2] is the second-last, and so on.