We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Day 0: Mean, Median, and Mode
Day 0: Mean, Median, and Mode
Sort by
recency
|
866 Discussions
|
Please Login in order to post a comment
import numpy as np from statistics import mean,median,mode no_of_elements = input() arr = list(map(int,input().split()))
print(round(mean(arr),1))
print(round(median(arr),1))
from collections import Counter
freq_dict = Counter(arr)
max_value = max(freq_dict.values())
result = [key for key,value in freq_dict.items() if value == max_value]
print(min(result))
PYTHON 3
Hi, Can I please ask someone to explain the input to me on HackerRank? Why is that if I try: print(input.split(" ")) I just get a 10, while I expect a list numbers in str format. But if I try print(list(map(int, input().split(" "))) I get a list? I have even tried to just print the input: s = input() print(s) but I only a 10 in stdout. How does the input() look like?