Skip to content
  • Tutorials
    • c programming
      • libraries
    • c++
    • Linux
    • Python
    • batch programming
    • Technology
  • IDE
  • Tools
python last index of item in list 1

python last index of item in list

May 6, 2022 by Anurag batra
your_list = ["apple", "orange", "grapes"]
last_value = your_list[-1]

Here is what the above code is Doing:
1. We create a list called your_list.
2. We create a variable called last_value and set it equal to the last element in your_list.
3. We print the value of last_value.

Categories Python Examples
Post navigation
python read dictionary from file
find all occurrences of an element in a list python
© MyEduKit - 2022 . All Rights Reserved.