Programming Examples

Python program to count frequency of a given element in a list of numbers


WAP to count frequency of a given element in a list of numbers.

Solution

L=[2,58,95,999,65,32,15,1,7,45]
n=int(input("Enter the number : "))
print("The frequency of number ",n," is ",L.count(n))
Output

Enter the number : 3
The frequency of number  3  is  0

--------------------------------------------------------

Enter the number : 58
The frequency of number  58  is  1
Online Exam Quiz for One day Exam Online Typing Test CCC Online Test 2026 Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level Online Test in Hindi Best Website and Software Company in Allahabad