forked from ada-c17/git-practice
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfunction_a.py
More file actions
27 lines (23 loc) · 791 Bytes
/
function_a.py
File metadata and controls
27 lines (23 loc) · 791 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
def most_common_value(number_list):
""" returns the most common element of the list
"""
frequency_index = {}
max_frequency = -1
most_common_value = None
for num in number_list:
if frequency_index.get(num):
frequency_index[num] += 1
else:
frequency_index[num] = 1
if max_frequency < frequency_index[num]:
max_frequency = frequency_index[num]
most_common_value = num
print("hello, sea turtle!")
print("Happy Friday!")
return most_common_value
print("Hailey wrote this, this is fun! Nice to work with you all :)")
if __name__ == "__main__":
nums = [1, 1, 3, 3, 3, 7, 8, 2, 1, 3]
print(f"Most common value = {most_common_value(nums)}")
def hello():
print("Hello world.")