From e4399e45502910c398f99eed84f04468c2881dc5 Mon Sep 17 00:00:00 2001 From: Mohammad S Anwar Date: Tue, 30 Apr 2024 23:52:42 +0100 Subject: - Added solutions by Eric Cheung. - Added solutions by Ulrich Rieke. - Added solutions by Reinier Maliepaard. - Added solutions by Mark Anderson. - Added solutions by Steven Wilson. - Added solutions by E. Choroba. - Added solutions by David Ferrone. - Added solutions by Peter Meszaros. - Added solutions by Peter Campbell Smith. - Added solutions by W. Luis Mochan. - Added solutions by PokGoPun. - Added solutions by Feng Chang. - Added solutions by Roger Bell_West. - Added solutions by Bob Lied. - Added solutions by Matthew Neleigh. - Added solutions by Dave Jacoby. --- challenge-267/eric-cheung/python/ch-1.py | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100755 challenge-267/eric-cheung/python/ch-1.py (limited to 'challenge-267/eric-cheung/python/ch-1.py') diff --git a/challenge-267/eric-cheung/python/ch-1.py b/challenge-267/eric-cheung/python/ch-1.py new file mode 100755 index 0000000000..c3f56490de --- /dev/null +++ b/challenge-267/eric-cheung/python/ch-1.py @@ -0,0 +1,8 @@ + +## arrInt = [-1, -2, -3, -4, 3, 2, 1] ## Example 1 +## arrInt = [1, 2, 0, -2, -1] ## Example 2 +arrInt = [-1, -1, 1, -1, 2] ## Example 3 + +arrNegCount = [nLoop for nLoop in arrInt if nLoop < 0] + +print (0 if 0 in arrInt else 1 if len(arrNegCount) % 2 == 0 else -1) -- cgit