get the last element of tuple in python
- Last modified: 30 March 2020
- Category: python tutorial
syntax
tuple[-1]
example
#tuple
animals = ('cat', 'dog', 'zebra', 'shark')
#get last element of tuple python
print(animals[-1])
output
shark
English today is not an art to be mastered it's just a tool to use to get a result