Last modified: Jan 10, 2023 By Alexander Williams
getting the last item of list python
syntax
1 | your_list[-1] |
example
1 2 3 | a_list=['elephant','dog','cat','zebra']print(a_list[-1]) |
output
1 | zebra |
Last modified: Jan 10, 2023 By Alexander Williams
1 | your_list[-1] |
1 2 3 | a_list=['elephant','dog','cat','zebra']print(a_list[-1]) |
output
1 | zebra |