how to take index first and last in python in one way
[some_list[0], some_list[-1]]
how to take index first and last in python in one way
[some_list[0], some_list[-1]]
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))
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us