diff options
Diffstat (limited to 'challenge-228/sgreen/python/ch-1.py')
| -rwxr-xr-x | challenge-228/sgreen/python/ch-1.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/challenge-228/sgreen/python/ch-1.py b/challenge-228/sgreen/python/ch-1.py new file mode 100755 index 0000000000..039b606169 --- /dev/null +++ b/challenge-228/sgreen/python/ch-1.py @@ -0,0 +1,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) |
