Write a Python Program to Get the Last Element of the List

Python Program to Get the Last Element of the List

Welcome to the World of Online Learning:

Hello Friends “This blog helps you to learn  Python programming concepts. You can learn Python language at your own speed and time. One can learn concepts of Python language by practicing various programs given on various pages of this blog. Enjoy the power of Self-learning using the Internet.”

Python Program to Get the Last Element of the List
Python Program to Get the Last Element of the List

Write a Python Program to Get the Last Element of the List

PROGRAM: Python Program to Get the Last Element of the List

/* Python Program to Get the Last Element of the List */

Using negative indexing

my_list = [‘a’, ‘b’, ‘c’, ‘d’, ‘e’]

# print the last element
print(my_list[-1])

OUTPUT:- e

Leave a Reply

Your email address will not be published. Required fields are marked *