Bruno BELANYI
acfc841539
This is mostly about unused imports. A couple errors remain, but are fine in my book (using `l` as a variable name, assigning a lambda to a variable).
21 lines
379 B
Python
Executable file
21 lines
379 B
Python
Executable file
#!/usr/bin/env python
|
|
|
|
import sys
|
|
from typing import List
|
|
|
|
|
|
def solve(input: List[str]) -> int:
|
|
nums = sorted(int(n) for n in input[0].split(","))
|
|
median = nums[len(nums) // 2]
|
|
|
|
return sum(abs(n - median) for n in nums)
|
|
|
|
|
|
def main() -> None:
|
|
input = [line.strip() for line in sys.stdin.readlines()]
|
|
print(solve(input))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|