aboutsummaryrefslogtreecommitdiff
path: root/challenge-122/abigail/python
diff options
context:
space:
mode:
authorE7-87-83 <fungcheokyin@gmail.com>2021-07-27 11:09:20 +0800
committerE7-87-83 <fungcheokyin@gmail.com>2021-07-27 11:09:20 +0800
commit2c7cef286eb7a72c36c28f8fa4c5a2a88b76e4af (patch)
treea2b64a6a110d201ceed00119701e94e5dc7c965f /challenge-122/abigail/python
parentf4e18fcb93b12bfc825272d2800e63ad4e56b140 (diff)
parent4231c2f762b397e1cacd2cb7e3c2799254fcc1a4 (diff)
downloadperlweeklychallenge-club-2c7cef286eb7a72c36c28f8fa4c5a2a88b76e4af.tar.gz
perlweeklychallenge-club-2c7cef286eb7a72c36c28f8fa4c5a2a88b76e4af.tar.bz2
perlweeklychallenge-club-2c7cef286eb7a72c36c28f8fa4c5a2a88b76e4af.zip
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'challenge-122/abigail/python')
-rw-r--r--challenge-122/abigail/python/ch-1.py19
-rw-r--r--challenge-122/abigail/python/ch-2.py25
2 files changed, 44 insertions, 0 deletions
diff --git a/challenge-122/abigail/python/ch-1.py b/challenge-122/abigail/python/ch-1.py
new file mode 100644
index 0000000000..b2fdeea20c
--- /dev/null
+++ b/challenge-122/abigail/python/ch-1.py
@@ -0,0 +1,19 @@
+#!/opt/local/bin/python
+
+#
+# See ../README.md
+#
+
+#
+# Run as: python ch-1.py < input-file
+#
+
+import fileinput
+
+s = 0
+c = 0
+
+for n in fileinput . input ():
+ s = s + int (n)
+ c = c + 1
+ print (s // c)
diff --git a/challenge-122/abigail/python/ch-2.py b/challenge-122/abigail/python/ch-2.py
new file mode 100644
index 0000000000..2c10b39f25
--- /dev/null
+++ b/challenge-122/abigail/python/ch-2.py
@@ -0,0 +1,25 @@
+#!/opt/local/bin/python
+
+#
+# See ../README.md
+#
+
+#
+# Run as: python ch-2.py < input-file
+#
+
+import sys
+
+n = int (sys . stdin . readline ())
+
+scores = [[], [], [""]]
+
+for i in range (n):
+ new = []
+ for j in range (3):
+ for k in scores [len (scores) - 1 - j]:
+ new . append (str (j + 1) + " " + k)
+ scores . append (new)
+
+for score in scores [-1]:
+ print (score)