I want that a user can enter digits and if the digits matches with the list values then the program returns the entered value and it's index too.
How can i do that? I have written some line of code but it is not working....
a = [10, 20, 30, 40, 50, 60]
inp = int(input("Enter digit"))
i =0
for i in a:
if inp == a[i]:
print("You found it {}".format(a[i]))
else:
print("No found")
It is raising an IndexError.