Median of 2

Back to Problem Solutions forum

Colvanila     2017-12-15 23:17:45

I'm using python but I'm having issues with the result. This "should" be right, but I'm not getting the median of each and every sequence (It's hit or miss). Any thoughts?

import statistics
count = input()
answer = []
for i in range(int(count)):
    a, b, c = input().split()
    mid = statistics.median([a, b, c])
    answer.append(mid)
print(*answer, sep=' ')

Edit* Median of 3

Colvanila     2017-12-15 23:57:40

Turns out I was having issues with declaring them as integers.

Solved!

Please login and solve 5 problems to be able to post at forum