From 4aa4b6f6ec667d730abd553085d3a719a7904603 Mon Sep 17 00:00:00 2001 From: IgnBys Date: Wed, 25 Oct 2023 15:38:54 +0200 Subject: [PATCH] TaskAO3 was ended --- TaskA03/TaskAO3.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 TaskA03/TaskAO3.py diff --git a/TaskA03/TaskAO3.py b/TaskA03/TaskAO3.py new file mode 100644 index 0000000..3165de5 --- /dev/null +++ b/TaskA03/TaskAO3.py @@ -0,0 +1,28 @@ +def openFile(fileName, ageArray = ['1', '9', '[0123456789]', '[0123456789]', ' ', 'r', '.']): + with open(fileName, "r", encoding="utf-8") as file: + for row in file: + repCounter = 0 + counter = 0 + checkWord =[] + for i in row: + if i in ageArray[counter]: + checkWord+=i + counter +=1 + if counter == 7: + repCounter+=1 + checkWord = [] + counter = 0 + if repCounter == 1: + print(row.strip()) + else: + checkWord = [] + counter = 0 + +print('---------------------SHAKESPEARE.EXP--------------------------------------') +openFile('polish_wiki_excerpt.exp') +print('----------------------SHAKESPEARE.EXP-----------------------------------') +openFile('polish_wiki_excerpt.in') +print('------------------------SIMPLE.IN------------------------------------') +openFile('simple.in') +print('-----------------------SIMPLE.EXP--------------------------------------') +openFile('simple.exp')