From 3bfcb36315febcc0b61b25ad2b996f5e266b6de2 Mon Sep 17 00:00:00 2001 From: Simon Green Date: Mon, 5 Sep 2022 00:41:26 +1000 Subject: sgreen solutions for challenge 180 --- challenge-180/sgreen/python/ch-2.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 challenge-180/sgreen/python/ch-2.py (limited to 'challenge-180/sgreen/python/ch-2.py') diff --git a/challenge-180/sgreen/python/ch-2.py b/challenge-180/sgreen/python/ch-2.py new file mode 100755 index 0000000000..1771161bbc --- /dev/null +++ b/challenge-180/sgreen/python/ch-2.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 + +import sys + + +def main(nums): + # Get the last number as the number to compare + n = float(nums.pop()) + + # Get all numbers > n + l = [i for i in nums if float(i) > n] + + # Print the numbers + print(*l, sep=', ') + + +if __name__ == '__main__': + main(sys.argv[1:]) -- cgit