summaryrefslogtreecommitdiff
path: root/comp/work/15
diff options
context:
space:
mode:
authorstandenboy <standenboy@StandenboyLAP.lan>2024-01-09 11:31:33 +0000
committerstandenboy <standenboy@StandenboyLAP.lan>2024-01-09 11:31:33 +0000
commitf267b783b87353a70eacf786e940d5d480c4da03 (patch)
tree267f238fbed3a604bc07bca5a3990b997fe0bd57 /comp/work/15
parent7403cd764714a6c9f322693785005504c108de71 (diff)
added eoracle
Diffstat (limited to 'comp/work/15')
-rw-r--r--comp/work/15/1a.py30
-rw-r--r--comp/work/15/file2
2 files changed, 32 insertions, 0 deletions
diff --git a/comp/work/15/1a.py b/comp/work/15/1a.py
new file mode 100644
index 0000000..6adb02f
--- /dev/null
+++ b/comp/work/15/1a.py
@@ -0,0 +1,30 @@
+def addTo(file):
+ f = open(file, "w")
+ towrite = []
+ line = ""
+ while line != "quit\n":
+ line = input()
+ line = line + "\n"
+ towrite.append(line)
+ towrite.remove("quit\n")
+ f.writelines(towrite)
+ f.close()
+
+def readFile(file):
+ f = open(file, "r")
+ print(*f.readlines(), sep="")
+ f.close()
+
+def readFileReverse(file):
+ f = open(file, "r")
+ towrite = ""
+ for i in f.readlines():
+ towrite = towrite + i
+ print(towrite[::-1])
+ f.close()
+
+
+
+file = "./file"
+addTo(file)
+readFileReverse(file)
diff --git a/comp/work/15/file b/comp/work/15/file
new file mode 100644
index 0000000..f98124c
--- /dev/null
+++ b/comp/work/15/file
@@ -0,0 +1,2 @@
+this is a line
+this is another