Answers for "how to check the first index of a element from last in list python"

1

how to take index first and last in python in one way

[some_list[0], some_list[-1]]
Posted by: Guest on January-04-2021
0

python last index of item in list

def list_rindex(li, x):
    for i in reversed(range(len(li))):
        if li[i] == x:
            return i
    raise ValueError("{} is not in list".format(x))
Posted by: Guest on April-19-2020

Code answers related to "how to check the first index of a element from last in list python"

Python Answers by Framework

Browse Popular Code Answers by Language