Index of last occurrence
Input
245678245238
2
a = [int(i) for i in input("Enter list of numbers: ").split()]
b = int(input("Search number: "))
index = 0
for i in range(len(a)):
if a[i] == b:
index = i
print("Index of Last Occurrence: ", index)
Comments
Leave a comment