Frequency of Elements :-
Python में Frequency of Elements का मतलब है कि किसी List, Tuple, String या अन्य Collection में कोई particular element कितनी बार आया है।
किसी element के occurrences (बार आने की संख्या) को उसकी Frequency कहा जाता है।
Example :-
मान लीजिए हमारे पास एक List है:
numbers = [10, 20, 10, 30, 10, 20]
इस List में:
10 → 3 बार आया है।
20 → 2 बार आया है।
30 → 1 बार आया है।
इसलिए:
Frequency of 10 = 3
Frequency of 20 = 2
Frequency of 30 = 1
Frequency का Basic Concept :-
Element → Number of Times it Occurs
उदाहरण:
List = [10, 20, 10, 30, 20, 10]
10 → 3 times
20 → 2 times
30 → 1 time
इस प्रकार, Frequency यह बताती है कि कोई particular element collection में कितनी बार मौजूद है।
Python में Frequency Find करने के तरीके :-
Python में किसी element की frequency पता करने के लिए मुख्य रूप से:
- count() method
- for loop और counter
- Dictionary
का उपयोग किया जा सकता है।
IN ENGLISH
Frequency of Elements :-
In Python, Frequency of Elements means how many times a particular element occurs in a List, Tuple, String, or other Collection.
In simple words, the number of occurrences of an element is called its Frequency.
Example :-
Suppose we have a List:
numbers = [10, 20, 10, 30, 10, 20]
In this List:
10 → Occurs 3 times.
20 → Occurs 2 times.
30 → Occurs 1 time.
Therefore:
Frequency of 10 = 3
Frequency of 20 = 2
Frequency of 30 = 1
Basic Concept of Frequency :-
Element → Number of Times it Occurs
Example:
List = [10, 20, 10, 30, 20, 10]
10 → 3 times
20 → 2 times
30 → 1 time
Thus, Frequency tells us how many times a particular element is present in a collection.
Ways to Find Frequency in Python :-
In Python, the frequency of an element can mainly be found using:
- count() method
- for loop and counter
- Dictionary