How to Get Second Last Element of List in Python?
Published On: 09/11/2022 | Category:
Python

Hi Guys,
I will explain step by step tutorial how to get second last element of list in python. Here you will learn how to find second last element in list python. you'll learn python get second item in list. I explained simply about python get second last element of list.
There are a few ways to get the second last element from the list in python. You could use either by key with -2 or using pop function. so let's see the below examples:
So let's see bellow example:
Example 1
main.pymyList = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'] # Get Last Element lastElem = myList[-2] print(lastElem)Output
Fri
It will help you....
Happy Pythonic Coding!