From 35d05b5d18968d106796212e2f5579084b92caa6 Mon Sep 17 00:00:00 2001 From: TheShinyMelon Date: Fri, 9 Dec 2022 22:59:42 +0100 Subject: [PATCH] sorry m8s i wrote a klausur today --- 6/tuer6.py | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/6/tuer6.py b/6/tuer6.py index 3f23810..48f867d 100644 --- a/6/tuer6.py +++ b/6/tuer6.py @@ -1,13 +1,19 @@ -inputFile = open("./input.txt", 'a+') -for c in inputFile: - area = inputFile.read(4) - check = "" - for a in area: - if a not in check: - check += a - if(check==area): - break +with open("./input.txt", 'r') as input_file: + i = 0 + tmp_str = "" -print("Stelle des heiligen Pandabären: ", inputFile.tell()) -print("Der Text an der Stelle: ", inputFile.seek(inputFile.tell()-1)) #hilf \ No newline at end of file + for c in input_file.read(): + tmp_str += c + i += 1 + if len(tmp_str) > 3: + area = tmp_str + tmp_str = "" + check = "" + for a in area: + if a not in check: + check += a + if check==area: + break + + print(tmp_str) \ No newline at end of file