Question #224544

write a program to print the index of the last occurence of the given number N in the list



Expert's answer

def func(list1):
  n = eval(input('Enter no here: '))
  list2 = list1[::-1]
  n1 = len(list1)-1
  if n in list2:
    print(n1 - list2.index(n))

func([1,2,3,4,2,6,7])
Enter no here: 2
4

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS