If tutorials available on this website are helpful for you, please whitelist this website in your ad blocker😭 or Donate to help us ❤️ pay for the web hosting to keep the website running.
python में statistics module का mode() method का use दिए गए numeric data set का mode (central tendency) calculate करता है।
mode का मतलब है किसी dataset में present most frequent value means वो value जो सबसे ज्यादा बार appear हुई है।
statistics.mode(data)
data | required : data जिसका हमें mode calculate करना है , आप इसमें values की list / tuple pass कर सकते हैं।
Return value : pass की गयी values के according value return होती है।
# Import statistics module.
import statistics
#pass data in list.
print('Calculate using list')
print(statistics.mode([3,4,4,3, 4]))
print(statistics.mode(['red', 'green', 'blue', 'red']))
#pass data in tiuple.
print('Calculate using tuple')
print(statistics.mode((3,3,3,3,4,4,3, 4)))
C:\Users\Rahulkumar\Desktop\python>python mode_test.py Calculate using list 4 red Calculate using tuple 3
Hi ! I'm Rahul Kumar Rajput founder of learnhindituts.com. I'm a software developer having more than 4 years of experience. I love to talk about programming as well as writing technical tutorials and blogs that can help to others. I'm here to help you navigate the coding cosmos and turn your ideas into reality, keep coding, keep learning :)
Get connected with me. :) LinkedIn Twitter Instagram Facebook