aboutsummaryrefslogtreecommitdiff
path: root/challenge-228/sgreen/python/ch-1.py
blob: 039b606169f0f0287f72efdf403b8b0b44901266 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env python3

import sys


def main(ints):
    # Get the frequency of all numbers
    freq = {}
    for i in ints:
        freq[i] = 1 + freq.get(i, 0)

    # Get the sum of all unique values
    solution = sum(i for i in freq if freq[i] == 1)
    print(solution)


if __name__ == '__main__':
    # Convert input into integers
    array = [int(n) for n in sys.argv[1:]]
    main(array)