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/ Explanation:

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

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

Enter the number : 58
The frequency of number  58  is  1
Latest Current Affairs 2024 Online Exam Quiz for One day Exam Online Typing Test CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online MBA 2 years Online MCA Online BCA Best Website and Software Company in Allahabad