Write a Python Program to print the Number of Times a Particular Number Occurs in a List


Topic: Write a Python Program to print the Number of Times a Particular Number Occurs in a List

Solution

a=[2, 3, 8, 9, 2, 4, 6]
k=0
num=int(input("Enter the number to be counted:"))
for j in a:
    if(j==num):
        k=k+1
print("Number of times",num,"appears is",k)



List all Python Programs