Mid2 16th_Find_Occurrences_of_Number

 l=[1,2,2,3,2,4]

a=int(input("Enter the number: "))
s=[]
for i in range(len(l)):
    if l[i]==a:
        s.append(i)
print(s)
print(len(s))
#output:
Enter the number: 2 [1, 2, 4] 3

Comments

Popular posts from this blog

JAVA Lab Programs

HANGMAN GAME

WD 22. StylingLinks&Buttons