Header Ads Widget

Write a python to print index of all occurrence of given element

 Code:-


print("Enter elements of the list")
mylist=list(map(int,input().split()))
num=int(input("Enter the element"))
for i in range(len(mylist)):
if mylist[i]==num:
print(i)


Output:-


Enter elements of the list
1 2 3 1 3 1 54 1 76 1 5 1 45
Enter the element1
0
3
5
7
9



Post a Comment

0 Comments