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
CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online Exam Quiz O Level NIELIT Study material and Quiz Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Best Website and Software Company in Allahabad Website development Company in Allahabad