[BOJ / Python] 2587 대표값2

도니·2023년 4월 15일

BOJ / Python

목록 보기
83/105
post-thumbnail

문제

백준 2587 대표값2

코드

nums = []
for _ in range(5):
    tmp = int(input())
    nums.append(tmp)

print(int(sum(nums)/5))
nums.sort()
print(nums[2])

중앙값 출력을 더욱 간결히 나타내면 다음과 같이도 나타낼 수 있다.

print(sorted(nums)[2])
profile
Where there's a will, there's a way

0개의 댓글