Hello friends!!!!!
Problem of the day
PYTHON
11/5/20241 min read
'''
Problem
Another measure of average
Mode is defined as the value that appears most often in a set of data values.
Mode corresponds to the most frequent value.
You are given a list of numbers and you need to calculate the mode of this list.
A list containing average daily temperature over 10 days
temperatures = [34, 40, 29, 33, 42, 40, 39, 34, 34,33 ]
'''
temperatures = [34, 40, 29, 33, 42, 40, 39, 34, 34,33 ]
t = temperatures
for i in range(0,10):
l = t[0]
if t.count(t[i]) > t.count(l) :
l = t[i]
print(f"{l} is the mode of the data")
Output:
34 is the mode of the data