From 7d19e6afee0f7c1245e151ce673931ce8849f57e Mon Sep 17 00:00:00 2001 From: Andrew Shitov Date: Sun, 20 Sep 2020 13:46:14 +0200 Subject: 078 in C++ and Python by ash --- challenge-078/ash/python/ch-1.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 challenge-078/ash/python/ch-1.py (limited to 'challenge-078/ash/python/ch-1.py') diff --git a/challenge-078/ash/python/ch-1.py b/challenge-078/ash/python/ch-1.py new file mode 100644 index 0000000000..2f6911a626 --- /dev/null +++ b/challenge-078/ash/python/ch-1.py @@ -0,0 +1,19 @@ +# Task 1 from +# https://perlweeklychallenge.org/blog/perl-weekly-challenge-078/ +# +# Comments: https://andrewshitov.com/2020/09/14/the-weekly-challenge-078/ +# +# Output: +# +# $ python3 ch-1.py +# 10 +# 7 +# 6 +# 1 + +data = 9, 10, 7, 5, 6, 1 + +for i in range(len(data) - 1): + if data[i] > max(data[i+1:]): + print(data[i]) +print(data[-1]) -- cgit