Skip to content
  • Tutorials
    • c programming
      • libraries
    • c++
    • Linux
    • Python
    • batch programming
    • Technology
  • IDE
  • Tools
find last element in python 1

find last element in python

April 12, 2022April 12, 2022 by Anurag batra
arr = ["cat", "dog", "rabbit"]
last_element = arr[-1]

Here is what the above code is Doing:
1. We create an array called arr.
2. We create a variable called last_element and set it equal to the last element in arr.
3. We print out the value of last_element.

Categories Python Examples
Post navigation
python add list to dictionary in loop
why for loop is not iterating python all values
© MyEduKit - 2022 . All Rights Reserved.